diff options
Diffstat (limited to 'crates/shirabe/src')
| -rw-r--r-- | crates/shirabe/src/command/package_discovery_trait.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/console/application.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/factory.rs | 8 | ||||
| -rw-r--r-- | crates/shirabe/src/json/json_file.rs | 19 | ||||
| -rw-r--r-- | crates/shirabe/src/json/json_manipulator.rs | 34 | ||||
| -rw-r--r-- | crates/shirabe/src/repository/composer_repository.rs | 14 | ||||
| -rw-r--r-- | crates/shirabe/src/util/auth_helper.rs | 11 | ||||
| -rw-r--r-- | crates/shirabe/src/util/gitlab.rs | 5 | ||||
| -rw-r--r-- | crates/shirabe/src/util/http/curl_downloader.rs | 2 | ||||
| -rw-r--r-- | crates/shirabe/src/util/perforce.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/util/remote_filesystem.rs | 4 |
11 files changed, 56 insertions, 53 deletions
diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs index b68be252..88c90a5a 100644 --- a/crates/shirabe/src/command/package_discovery_trait.rs +++ b/crates/shirabe/src/command/package_discovery_trait.rs @@ -24,7 +24,7 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ Exception, InvalidArgumentException, LogicException, PHP_EOL, PhpMixed, array_keys, array_slice, asort, explode, file_get_contents, implode, in_array_strict, is_array, is_file, - is_numeric, json_decode, levenshtein, php_regex, strlen, strpos, trim, + is_numeric, json_decode_assoc, levenshtein, php_regex, strlen, strpos, trim, }; use shirabe_symfony_console::input::InputInterface; use shirabe_symfony_console::output::OutputInterface; @@ -113,7 +113,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { let file = Factory::get_composer_file().unwrap_or_default(); if is_file(&file) && Filesystem::is_readable(&file) { let contents = file_get_contents(&file).unwrap_or_default(); - let composer = json_decode(&contents, true).unwrap_or(PhpMixed::Null); + let composer = json_decode_assoc(&contents).unwrap_or(PhpMixed::Null); if is_array(&composer) && let Some(arr) = composer.as_array() && let Some(ms) = arr.get("minimum-stability") diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index fb89f8b0..04819b81 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -60,7 +60,7 @@ use shirabe_php_shim::{ LogicException as ShimLogicException, PhpMixed, RuntimeException, bin2hex, chdir, defined, dirname, disk_free_space, extension_loaded, file_exists, file_get_contents, file_put_contents, function_exists, getcwd, getmypid, glob, ini_set, is_array, is_dir, is_file, is_string, - json_decode, memory_get_peak_usage, memory_get_usage, microtime, php_regex, php_uname, + json_decode_assoc, memory_get_peak_usage, memory_get_usage, microtime, php_regex, php_uname, posix_getuid, random_bytes, realpath, restore_error_handler, round, str_replace, strpos, strtoupper, sys_get_temp_dir, time, unlink, }; @@ -2341,7 +2341,7 @@ impl ApplicationHandle { let file = Factory::get_composer_file().unwrap_or_default(); if may_need_script_command && is_file(&file) && Filesystem::is_readable(&file) { let composer_json: PhpMixed = - json_decode(&file_get_contents(&file).unwrap_or_default(), true) + json_decode_assoc(&file_get_contents(&file).unwrap_or_default()) .unwrap_or(PhpMixed::Null); if let Some(arr) = composer_json.as_array() && let Some(scripts) = arr.get("scripts").and_then(|v| v.as_array()) diff --git a/crates/shirabe/src/factory.rs b/crates/shirabe/src/factory.rs index fe5a0ec8..b821784d 100644 --- a/crates/shirabe/src/factory.rs +++ b/crates/shirabe/src/factory.rs @@ -55,8 +55,8 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ InvalidArgumentException, PATHINFO_EXTENSION, PHP_EOL, PHP_OS, PhpMixed, RuntimeException, UnexpectedValueException, array_replace_recursive, class_exists, dirname, extension_loaded, - file_exists, file_get_contents, file_put_contents, implode, is_dir, is_file, json_decode, - mkdir, pathinfo, realpath, rename, rtrim, strpos, strtr, substr, trim, + file_exists, file_get_contents, file_put_contents, implode, is_dir, is_file, json_decode_assoc, + json_decode_obj, mkdir, pathinfo, realpath, rename, rtrim, strpos, strtr, substr, trim, }; use shirabe_symfony_console::formatter::OutputFormatter; use shirabe_symfony_console::formatter::OutputFormatterStyle; @@ -1529,7 +1529,7 @@ impl Factory { _ => return Ok(()), }; - let auth_data = json_decode(&composer_auth_env_str, false)?; + let auth_data = json_decode_obj(&composer_auth_env_str)?; if matches!(auth_data, PhpMixed::Null) { return Err(UnexpectedValueException::new( "COMPOSER_AUTH environment variable is malformed, should be a valid JSON object" @@ -1551,7 +1551,7 @@ impl Factory { JsonFile::AUTH_SCHEMA, Some("COMPOSER_AUTH"), )?; - let auth_data_assoc = json_decode(&composer_auth_env_str, true)?; + let auth_data_assoc = json_decode_assoc(&composer_auth_env_str)?; if !matches!(auth_data_assoc, PhpMixed::Null) { let mut wrapped: IndexMap<String, PhpMixed> = IndexMap::new(); wrapped.insert("config".to_string(), auth_data_assoc); diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs index 78ed76d7..e31cd70d 100644 --- a/crates/shirabe/src/json/json_file.rs +++ b/crates/shirabe/src/json/json_file.rs @@ -14,8 +14,8 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ InvalidArgumentException, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE, PhpMixed, RuntimeException, UnexpectedValueException, dirname, file_exists, file_get_contents, - file_put_contents, is_dir, is_file, json_decode, json_encode_ex, mkdir, php_regex, realpath, - str_repeat, strlen, strpos, usleep, + file_put_contents, is_dir, is_file, json_decode_assoc, json_decode_obj, json_encode_ex, mkdir, + php_regex, realpath, str_repeat, strlen, strpos, usleep, }; use shirabe_seld_json_lint::{ParsingException, ParsingExceptionDetails}; @@ -309,7 +309,7 @@ impl JsonFile { .into()); } let content = file_get_contents(&self.path).unwrap_or_default(); - let data = json_decode(&content, false)?; + let data = json_decode_obj(&content)?; if matches!(data, PhpMixed::Null) && content != "null" { Self::validate_syntax(&content, Some(&self.path))?; @@ -362,7 +362,7 @@ impl JsonFile { }; if schema == Self::STRICT_SCHEMA && is_composer_schema_file { - schema_data = json_decode(Self::COMPOSER_SCHEMA_JSON, false)?; + schema_data = json_decode_obj(Self::COMPOSER_SCHEMA_JSON)?; if let PhpMixed::Object(map) = &mut schema_data { map.insert("additionalProperties".to_string(), PhpMixed::Bool(false)); map.insert( @@ -476,11 +476,12 @@ impl JsonFile { None => return Ok(PhpMixed::Null), Some(j) => j, }; - let mut data = json_decode(json, true)?; + let mut data = json_decode_assoc(json)?; // PHP: `null === $data && JSON_ERROR_NONE !== json_last_error()`, i.e. the decode produced - // null because of an error rather than because the input was the literal `null`. json_decode - // here swallows the error into PhpMixed::Null, so detect the failure by comparing the source - // against `null`, mirroring validateSchema's own `'null' !== $content` check. + // null because of an error rather than because the input was the literal `null`. + // json_decode_assoc swallows the error into PhpMixed::Null, so detect the failure by + // comparing the source against `null`, mirroring validateSchema's own + // `'null' !== $content` check. if matches!(data, PhpMixed::Null) && json != "null" { // attempt resolving simple conflicts in lock files so that one can run `composer update --lock` and get a valid lock file if let Some(file) = file @@ -498,7 +499,7 @@ impl JsonFile { &mut count, ); if count == 1 { - data = json_decode(&replaced, true)?; + data = json_decode_assoc(&replaced)?; if !matches!(data, PhpMixed::Null) { return Ok(data); } diff --git a/crates/shirabe/src/json/json_manipulator.rs b/crates/shirabe/src/json/json_manipulator.rs index 766137ca..08880e80 100644 --- a/crates/shirabe/src/json/json_manipulator.rs +++ b/crates/shirabe/src/json/json_manipulator.rs @@ -8,8 +8,8 @@ use shirabe_pcre::{CaptureKey, Preg}; use shirabe_php_shim::{ InvalidArgumentException, LogicException, PhpMixed, addcslashes, array_key_exists, array_keys, array_reverse, empty, explode, implode, in_array_loose, is_array, is_int, is_numeric, - json_decode, php_regex, php_truthy, preg_quote, rtrim, str_repeat, str_replace, strlen, - strnatcmp, strpos, substr, trim, uksort, + json_decode_assoc, json_decode_obj, php_regex, php_truthy, preg_quote, rtrim, str_repeat, + str_replace, strlen, strnatcmp, strpos, substr, trim, uksort, }; #[derive(Debug)] @@ -156,7 +156,7 @@ impl JsonManipulator { } if sort_packages { - let mut requirements = json_decode(&links, true)?; + let mut requirements = json_decode_assoc(&links)?; Self::sort_packages(&mut requirements); links = self.format(&requirements, 0, false)?; } @@ -230,7 +230,7 @@ impl JsonManipulator { } fn do_convert_repositories_from_assoc_to_list(&mut self) -> anyhow::Result<bool> { - let decoded = json_decode(&self.contents, false)?; + let decoded = json_decode_obj(&self.contents)?; let repositories_value: Option<PhpMixed> = decoded .as_object() @@ -405,7 +405,7 @@ impl JsonManipulator { let raw_repo = self.contents[repo_pos..repo_end].to_string(); // invalid match due to un-regexable content, abort - if json_decode(&raw_repo, false)?.as_bool() == Some(false) { + if json_decode_obj(&raw_repo)?.as_bool() == Some(false) { return Ok(false); } @@ -515,7 +515,7 @@ impl JsonManipulator { } fn do_remove_repository(&mut self, name: &str) -> anyhow::Result<bool> { - let decoded = json_decode(&self.contents, false)?; + let decoded = json_decode_obj(&self.contents)?; let repositories_value: Option<PhpMixed> = decoded .as_object() .and_then(|o| o.get("repositories").cloned()); @@ -706,7 +706,7 @@ impl JsonManipulator { let node_end = self.contents[node.value_end..].to_string(); let mut children = self.contents[node.value_pos..node.value_end].to_string(); // invalid match due to un-regexable content, abort - if !php_truthy(&json_decode(&children, false)?) { + if !php_truthy(&json_decode_obj(&children)?) { return Ok(false); } @@ -723,7 +723,7 @@ impl JsonManipulator { let content_str = children[cm.value_pos..cm.value_end].to_string(); let mut value_local = value; if let Some(sub_name) = sub_name { - let mut cur_val = json_decode(&content_str, true).unwrap_or(PhpMixed::Null); + let mut cur_val = json_decode_assoc(&content_str).unwrap_or(PhpMixed::Null); if !is_array(&cur_val) { cur_val = PhpMixed::Array(IndexMap::new()); } @@ -858,7 +858,7 @@ impl JsonManipulator { let children = self.contents[node.value_pos..node.value_end].to_string(); // invalid match due to un-regexable content, abort - if !php_truthy(&json_decode(&children, true)?) { + if !php_truthy(&json_decode_assoc(&children)?) { return Ok(false); } @@ -956,7 +956,7 @@ impl JsonManipulator { // we have a subname, so we restore the rest of $name if let Some(sub) = sub_name { - let mut cur_val = json_decode(&children, true)?; + let mut cur_val = json_decode_assoc(&children)?; if let Some(arr) = cur_val.as_array_mut() { if let Some(inner) = arr.get_mut(&name_owned).and_then(|v| v.as_array_mut()) { inner.shift_remove(&sub); @@ -985,7 +985,7 @@ impl JsonManipulator { // subkey removed when a sub_name is in play. let mut children_final = children_clean.clone(); if let Some(ref sub) = sub_name { - let mut cur_val = json_decode(&children, true).unwrap_or(PhpMixed::Null); + let mut cur_val = json_decode_assoc(&children).unwrap_or(PhpMixed::Null); if let Some(arr) = cur_val.as_array_mut() { if let Some(inner) = arr.get_mut(&name_owned).and_then(|v| v.as_array_mut()) { inner.shift_remove(sub); @@ -1035,7 +1035,7 @@ impl JsonManipulator { let node_end = self.contents[node.value_end..].to_string(); let mut children = self.contents[node.value_pos..node.value_end].to_string(); // invalid match due to un-regexable content, abort - if json_decode(&children, false)?.as_bool() == Some(false) { + if json_decode_obj(&children)?.as_bool() == Some(false) { return Ok(false); } @@ -1168,7 +1168,7 @@ impl JsonManipulator { let node_end = self.contents[node.value_end..].to_string(); let children = self.contents[node.value_pos..node.value_end].to_string(); // invalid match due to un-regexable content, abort - if json_decode(&children, false)?.as_bool() == Some(false) { + if json_decode_obj(&children)?.as_bool() == Some(false) { return Ok(false); } @@ -1233,7 +1233,7 @@ impl JsonManipulator { let children = self.contents[node.value_pos..node.value_end].to_string(); // invalid match due to un-regexable content, abort - if json_decode(&children, true)?.as_bool() == Some(false) { + if json_decode_assoc(&children)?.as_bool() == Some(false) { return Ok(false); } @@ -1314,7 +1314,7 @@ impl JsonManipulator { if let Some(m) = key_match { // invalid match due to un-regexable content, abort let key_capture = &self.contents[m.key_pos..m.value_end]; - if json_decode(&format!("{{{}}}", key_capture), false)?.is_null() { + if json_decode_obj(&format!("{{{}}}", key_capture))?.is_null() { return Ok(false); } @@ -1396,7 +1396,7 @@ impl JsonManipulator { if let Some(m) = key_match { // invalid match due to un-regexable content, abort let removal = &self.contents[m.key_pos..m.value_end]; - if json_decode(&format!("{{{}}}", removal), false)?.is_null() { + if json_decode_obj(&format!("{{{}}}", removal))?.is_null() { return Ok(false); } @@ -1448,7 +1448,7 @@ impl JsonManipulator { if let Some(m) = key_match { // invalid match due to un-regexable content, abort let removal = &self.contents[m.value_pos..m.value_end]; - if json_decode(removal, false)?.as_bool() == Some(false) { + if json_decode_obj(removal)?.as_bool() == Some(false) { return Ok(false); } diff --git a/crates/shirabe/src/repository/composer_repository.rs b/crates/shirabe/src/repository/composer_repository.rs index 614df9e3..2faf33dc 100644 --- a/crates/shirabe/src/repository/composer_repository.rs +++ b/crates/shirabe/src/repository/composer_repository.rs @@ -42,7 +42,7 @@ use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ AnyThrowable, CmpOp, InvalidArgumentException, LogicException, PHP_EOL, PhpMixed, RuntimeException, UnexpectedValueException, extension_loaded, hash, http_build_query_mixed, - json_decode, parse_url, php_regex, realpath, strtolower, strtr, urlencode, var_export, + json_decode_assoc, parse_url, php_regex, realpath, strtolower, strtr, urlencode, var_export, }; use shirabe_semver::CompilingMatcher; use shirabe_semver::constraint::AnyConstraint; @@ -1348,7 +1348,7 @@ impl ComposerRepository { && self.cache.borrow_mut().sha256(&cache_key).as_deref() == hash_opt.as_deref() { if let Some(raw) = self.cache.borrow_mut().read(&cache_key) { - let decoded = json_decode(&raw, true)?; + let decoded = json_decode_assoc(&raw)?; if let Some(arr) = decoded.as_array() { let map: IndexMap<String, PhpMixed> = arr.iter().map(|(k, v)| (k.clone(), v.clone())).collect(); @@ -1363,7 +1363,7 @@ impl ComposerRepository { } else if use_last_modified_check { let contents_raw_opt = self.cache.borrow_mut().read(&cache_key); if let Some(contents_raw) = contents_raw_opt { - let contents = json_decode(&contents_raw, true)?; + let contents = json_decode_assoc(&contents_raw)?; let contents_arr = contents.as_array().cloned(); // we already loaded some packages from this file, so assume it is fresh and avoid fetching it again if already_loaded.contains_key(name) { @@ -1962,7 +1962,7 @@ impl ComposerRepository { let mut last_modified: Option<String> = None; let contents_opt: Option<IndexMap<String, PhpMixed>>; if let Some(raw) = self.cache.borrow_mut().read(&cache_key) { - let decoded = json_decode(&raw, true)?; + let decoded = json_decode_assoc(&raw)?; if let Some(arr) = decoded.as_array() { let map: IndexMap<String, PhpMixed> = arr.iter().map(|(k, v)| (k.clone(), v.clone())).collect(); @@ -2127,7 +2127,7 @@ impl ComposerRepository { let mut data: Option<IndexMap<String, PhpMixed>> = None; let cached_raw_opt = self.cache.borrow_mut().read("packages.json"); if let Some(cached_raw) = cached_raw_opt { - let cached_decoded = json_decode(&cached_raw, true)?; + let cached_decoded = json_decode_assoc(&cached_raw)?; if let Some(arr) = cached_decoded.as_array() { let cached_data: IndexMap<String, PhpMixed> = arr.iter().map(|(k, v)| (k.clone(), v.clone())).collect(); @@ -2522,7 +2522,7 @@ impl ComposerRepository { == Some(sha256.as_str()) { let raw = self.cache.borrow_mut().read(&cache_key).unwrap_or_default(); - let decoded = json_decode(&raw, true)?; + let decoded = json_decode_assoc(&raw)?; decoded .as_array() .map(|a| a.iter().map(|(k, v)| (k.clone(), v.clone())).collect()) @@ -2612,7 +2612,7 @@ impl ComposerRepository { let included_data: IndexMap<String, PhpMixed> = if let Some(ref sha1) = sha1 { if self.cache.borrow_mut().sha1(include).as_deref() == Some(sha1.as_str()) { let raw = self.cache.borrow_mut().read(include).unwrap_or_default(); - let decoded = json_decode(&raw, true)?; + let decoded = json_decode_assoc(&raw)?; decoded .as_array() .map(|a| a.iter().map(|(k, v)| (k.clone(), v.clone())).collect()) diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs index 3b8aa2e7..7d47f088 100644 --- a/crates/shirabe/src/util/auth_helper.rs +++ b/crates/shirabe/src/util/auth_helper.rs @@ -12,7 +12,8 @@ use indexmap::IndexMap; use shirabe_pcre::Preg; use shirabe_php_shim::{ PhpMixed, RuntimeException, base64_encode, explode, in_array_loose, in_array_strict, is_array, - is_string, json_decode, parse_url, php_regex, str_replace, strpos, strtolower, substr, trim, + is_string, json_decode_assoc, parse_url, php_regex, str_replace, strpos, strtolower, substr, + trim, }; #[derive(Debug)] @@ -189,7 +190,7 @@ impl AuthHelper { // Try to extract a more specific error message from GitHub's API response let mut git_hub_api_message: Option<String> = None; if let Some(body) = response_body { - let decoded = json_decode(body, true)?; + let decoded = json_decode_assoc(body)?; if is_array(&decoded) && let Some(arr) = decoded.as_array() && let Some(msg) = arr.get("message") @@ -520,7 +521,7 @@ impl AuthHelper { let mut custom_headers: PhpMixed = PhpMixed::Null; // PHP: if (is_string($auth['username'])) // username field is always String in our IndexMap representation - custom_headers = json_decode(&username, true)?; + custom_headers = json_decode_assoc(&username)?; if is_array(&custom_headers) { if let Some(arr) = custom_headers.as_array() { for header in arr.values() { @@ -580,12 +581,12 @@ impl AuthHelper { Some("Using Bitbucket OAuth token authentication".to_string()); } } else if username == "client-certificate" { - // PHP: $options['ssl'] = array_merge($options['ssl'] ?? [], json_decode((string) $auth['password'], true)); + // PHP: $options['ssl'] = array_merge($options['ssl'] ?? [], json_decode_assoc((string) $auth['password'])); let existing_ssl = options .get("ssl") .cloned() .unwrap_or(PhpMixed::Array(IndexMap::new())); - let decoded = json_decode(&password, true)?; + let decoded = json_decode_assoc(&password)?; options.insert( "ssl".to_string(), shirabe_php_shim::array_merge(existing_ssl, decoded), diff --git a/crates/shirabe/src/util/gitlab.rs b/crates/shirabe/src/util/gitlab.rs index ef68c82f..52707b5b 100644 --- a/crates/shirabe/src/util/gitlab.rs +++ b/crates/shirabe/src/util/gitlab.rs @@ -12,7 +12,8 @@ use indexmap::IndexMap; use shirabe_pcre::Preg; use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ - PhpMixed, RuntimeException, http_build_query, in_array_strict, json_decode, php_regex, time, + PhpMixed, RuntimeException, http_build_query, in_array_strict, json_decode_assoc, php_regex, + time, }; #[derive(Debug)] @@ -253,7 +254,7 @@ impl GitLab { Some(te) if te.get_code() == 403 || te.get_code() == 401 => { if te.get_code() == 401 { let response = - te.get_response().and_then(|r| json_decode(r, true).ok()); + te.get_response().and_then(|r| json_decode_assoc(r).ok()); let is_invalid_grant = response .as_ref() .and_then(|r| r.as_array()) diff --git a/crates/shirabe/src/util/http/curl_downloader.rs b/crates/shirabe/src/util/http/curl_downloader.rs index 742e0fd3..6140bb08 100644 --- a/crates/shirabe/src/util/http/curl_downloader.rs +++ b/crates/shirabe/src/util/http/curl_downloader.rs @@ -339,7 +339,7 @@ impl CurlDownloader { && curl_response.inner.get_header("content-type").as_deref() == Some("application/json") && let Some(body) = curl_response.inner.get_body() { - let decoded = shirabe_php_shim::json_decode(body, true)?; + let decoded = shirabe_php_shim::json_decode_assoc(body)?; if let PhpMixed::Array(a) = decoded { HttpDownloader::output_warnings(self.io.clone(), origin, &a)?; } diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs index fbab6889..c0cd5a08 100644 --- a/crates/shirabe/src/util/perforce.rs +++ b/crates/shirabe/src/util/perforce.rs @@ -9,7 +9,7 @@ use indexmap::IndexMap; use shirabe_pcre::Preg; use shirabe_php_shim::{ Exception, PHP_EOL, PhpMixed, PhpResource, chdir, date_local, explode, fclose, feof, fgets, - file_get_contents, fopen, fwrite, gethostname, json_decode, php_regex, str_replace_array, + file_get_contents, fopen, fwrite, gethostname, json_decode_assoc, php_regex, str_replace_array, strcmp, strlen, strpos, strrpos, substr, time, trim, }; use shirabe_symfony_process::ExecutableFinder; @@ -577,7 +577,7 @@ impl Perforce { Some(s) => s, }; - let decoded = json_decode(&composer_file_content, true)?; + let decoded = json_decode_assoc(&composer_file_content)?; Ok(match decoded { PhpMixed::Array(m) => Some(m.into_iter().collect()), _ => None, diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs index 61165b28..4a8ca267 100644 --- a/crates/shirabe/src/util/remote_filesystem.rs +++ b/crates/shirabe/src/util/remote_filesystem.rs @@ -19,7 +19,7 @@ use shirabe_php_shim::{ PhpMixed, RuntimeException, STREAM_NOTIFY_FAILURE, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_PROGRESS, array_replace_recursive, base64_encode, explode, extension_loaded, file_get_contents, file_get_contents5, file_put_contents, filter_var_boolean, gethostbyname, - http_clear_last_response_headers, http_get_last_response_headers, ini_get, json_decode, + http_clear_last_response_headers, http_get_last_response_headers, ini_get, json_decode_assoc, parse_url, php_regex, preg_quote, strpos, strtolower, strtr, substr, trim, zlib_decode, }; @@ -336,7 +336,7 @@ impl RemoteFilesystem { { let parsed = result .as_deref() - .map(|s| json_decode(s, true).unwrap_or(PhpMixed::Null)) + .map(|s| json_decode_assoc(s).unwrap_or(PhpMixed::Null)) .unwrap_or(PhpMixed::Null); let parsed_map: IndexMap<String, PhpMixed> = match parsed { PhpMixed::Array(m) => m.into_iter().collect(), |
