diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-25 04:57:03 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-25 04:57:20 +0900 |
| commit | 541a8b4fd2c4b9538e2c88c5a7c4f9ffb5ca25eb (patch) | |
| tree | cbe1e5e9c8edec2a3a875ef0eade99aa4d38e7c4 /crates/shirabe-php-shim | |
| parent | c65cab710bb3d79db20862c9361d4dbbac8ac5d7 (diff) | |
| download | php-shirabe-541a8b4fd2c4b9538e2c88c5a7c4f9ffb5ca25eb.tar.gz php-shirabe-541a8b4fd2c4b9538e2c88c5a7c4f9ffb5ca25eb.tar.zst php-shirabe-541a8b4fd2c4b9538e2c88c5a7c4f9ffb5ca25eb.zip | |
feat(json): validate JSON schema via the jsonschema crate
Replace the todo!() json_schema::Validator stub with the jsonschema crate.
Errors are surfaced as 'property : message'; the message wording follows the
jsonschema crate and is *not* justinrainbow-compatible.
Port the ComposerSchemaTest and JsonFileTest schema cases to the new wording
(noted per test).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim')
| -rw-r--r-- | crates/shirabe-php-shim/src/fs.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/shirabe-php-shim/src/fs.rs b/crates/shirabe-php-shim/src/fs.rs index e70d397..ee2bbee 100644 --- a/crates/shirabe-php-shim/src/fs.rs +++ b/crates/shirabe-php-shim/src/fs.rs @@ -798,6 +798,12 @@ pub fn file_put_contents3(_filename: &str, _data: &str, _flags: i64) -> Option<i } pub fn file_get_contents(path: impl AsRef<std::path::Path>) -> Option<String> { + let path = path.as_ref(); + // PHP supports the file:// stream wrapper; strip it to read the local file. + let path = path + .to_str() + .and_then(|s| s.strip_prefix("file://")) + .map_or(path, std::path::Path::new); std::fs::read(path) .ok() .map(|bytes| String::from_utf8_lossy(&bytes).into_owned()) |
