- Timestamp:
- Mar 25, 2023 6:30:53 AM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r788 r789 122 122 * @author Quinn Comendant <quinn@strangecode.com> 123 123 */ 124 function getDump($var, $serialize=false, $dump_method=SC_DUMP_ PRINT_R)124 function getDump($var, $serialize=false, $dump_method=SC_DUMP_JSON) 125 125 { 126 126 $app =& App::getInstance(); … … 128 128 switch ($dump_method) { 129 129 case SC_DUMP_PRINT_R: 130 default:131 130 // Print human-readable descriptions of invisible types. 132 131 if (null === $var) { … … 163 162 164 163 case SC_DUMP_JSON: 164 default: 165 165 $json_flags = $serialize ? 0 : JSON_PRETTY_PRINT; 166 166 return json_encode($var, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK | $json_flags); … … 890 890 $app =& App::getInstance(); 891 891 892 if (is_null($content) || is_bool($content) || is_object($content) || is_array($content)) { 893 $app->logMsg(sprintf("Failed writing to file '%s'. Content is not a string.", $filename), LOG_WARNING, __FILE__, __LINE__); 894 return false; 895 } 896 892 897 // Open file for writing and truncate to zero length. 893 898 if ($fp = fopen($filename, 'w')) { 894 899 if (flock($fp, LOCK_EX)) { 895 if (!fwrite($fp, $content, mb_strlen($content))) {900 if (!fwrite($fp, (string)$content)) { 896 901 $app->logMsg(sprintf('Failed writing to file: %s', $filename), LOG_ERR, __FILE__, __LINE__); 897 902 fclose($fp);
Note: See TracChangeset
for help on using the changeset viewer.