diff --git a/www/admin/class_test.array.php b/www/admin/class_test.array.php index cc1789b3..381816ed 100644 --- a/www/admin/class_test.array.php +++ b/www/admin/class_test.array.php @@ -21,7 +21,7 @@ ob_end_flush(); use CoreLibs\Combined\ArrayHandler; use CoreLibs\Debug\Support as DgS; use CoreLibs\Convert\SetVarType; -use PHPUnit\Framework\Constraint\ArrayHasKey; +// use PHPUnit\Framework\Constraint\ArrayHasKey; $log = new CoreLibs\Logging\Logging([ 'log_folder' => BASE . LOG, diff --git a/www/admin/class_test.datetime.php b/www/admin/class_test.datetime.php index 7255c368..76697b6d 100644 --- a/www/admin/class_test.datetime.php +++ b/www/admin/class_test.datetime.php @@ -451,6 +451,7 @@ function intervalStringFormatDeprecated( $value = $interval->days; $skip = true; } else { + /** @phan-suppress-next-line PhanUndeclaredProperty */ $value = $interval->$part; } if ($value == 0 && $skip_last_zero === true) { diff --git a/www/admin/class_test.db.query-placeholder.php b/www/admin/class_test.db.query-placeholder.php index da052c4e..6010d05f 100644 --- a/www/admin/class_test.db.query-placeholder.php +++ b/www/admin/class_test.db.query-placeholder.php @@ -20,7 +20,7 @@ $LOG_FILE_ID = 'classTest-db-query-placeholder'; ob_end_flush(); use CoreLibs\Debug\Support; -use CoreLibs\DB\Support\ConvertPlaceholder; +// use CoreLibs\DB\Support\ConvertPlaceholder; $log = new CoreLibs\Logging\Logging([ 'log_folder' => BASE . LOG, diff --git a/www/admin/class_test.db.single.php b/www/admin/class_test.db.single.php index ea196ff0..47445f83 100644 --- a/www/admin/class_test.db.single.php +++ b/www/admin/class_test.db.single.php @@ -19,7 +19,7 @@ require 'config.php'; $LOG_FILE_ID = 'classTest-db-query-placeholders'; ob_end_flush(); -use CoreLibs\Debug\Support; +// use CoreLibs\Debug\Support; $log = new CoreLibs\Logging\Logging([ 'log_folder' => BASE . LOG, diff --git a/www/admin/class_test.smarty.php b/www/admin/class_test.smarty.php index 6eb54f06..e752ccba 100644 --- a/www/admin/class_test.smarty.php +++ b/www/admin/class_test.smarty.php @@ -97,7 +97,7 @@ $smarty->DATA['drop_down_test'] = [ 'foobar' => 'Foo Bar', ]; $smarty->DATA['drop_down_test_selected'] = 'bar'; -$smarty->DATA['drop_down_test_nested'] = [ +$smarty->DATA['drop_down_test_nested'] = [ '' => '選択してください', '4/25(木)' => [ '4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50', diff --git a/www/lib/CoreLibs/DB/Support/ConvertPlaceholder.php b/www/lib/CoreLibs/DB/Support/ConvertPlaceholder.php index bcfd5613..6e652acc 100644 --- a/www/lib/CoreLibs/DB/Support/ConvertPlaceholder.php +++ b/www/lib/CoreLibs/DB/Support/ConvertPlaceholder.php @@ -39,9 +39,11 @@ class ConvertPlaceholder ): array { $convert_to = strtolower($convert_to); $matches = []; + $query_split = '[(=,?-]|->|->>|#>|#>>|@>|<@|\?\|\?\&|\|\||#-'; $pattern = '/' // prefix string part, must match towards - . '(?:\'.*?\')?\s*(?:\?\?|[(=,])\s*' + // seperator for ( = , ? - [and json/jsonb in pg doc section 9.15] + . '(?:\'.*?\')?\s*(?:\?\?|' . $query_split . ')\s*' // match for replace part . '(?:' // digit -> ignore @@ -96,7 +98,10 @@ class ConvertPlaceholder $type = 'named'; $matches_return = $named_matches; // only check for :named - $pattern_replace = '/((?:\'.*?\')?\s*(?:\?\?|[(=,])\s*)(\d+|(?:\'.*?\')|(:\w+))/s'; + $pattern_replace = '/' + . '((?:\'.*?\')?\s*(?:\?\?|' . $query_split . ')\s*)' + . '(\d+|(?:\'.*?\')|(:\w+))' + . '/s'; // 0: full // 1: pre part // 2: keep part UNLESS '3' is set @@ -134,7 +139,10 @@ class ConvertPlaceholder // order and data stays the same $params_new = $params; // only check for ? - $pattern_replace = '/((?:\'.*?\')?\s*(?:\?\?|[(=,])\s*)(\d+|(?:\'.*?\')|(?:(?:\?\?)?\s*(\?{1})))/s'; + $pattern_replace = '/' + . '((?:\'.*?\')?\s*(?:\?\?|' . $query_split . ')\s*)' + . '(\d+|(?:\'.*?\')|(?:(?:\?\?)?\s*(\?{1})))' + . '/s'; // 0: full // 1: pre part // 2: keep part UNLESS '3' is set @@ -163,7 +171,10 @@ class ConvertPlaceholder $type = 'numbered'; $matches_return = $numbered_matches; // only check for $n - $pattern_replace = '/((?:\'.*?\')?\s*(?:\?\?|[(=,])\s*)(\d+|(?:\'.*?\')|(\$[1-9]{1}(?:[0-9]{1,})?))/s'; + $pattern_replace = '/' + . '((?:\'.*?\')?\s*(?:\?\?|' . $query_split . ')\s*)' + . '(\d+|(?:\'.*?\')|(\$[1-9]{1}(?:[0-9]{1,})?))' + . '/s'; // 0: full // 1: pre part // 2: keep part UNLESS '3' is set diff --git a/www/lib/CoreLibs/Language/Core/CachedFileReader.php b/www/lib/CoreLibs/Language/Core/CachedFileReader.php index 95721bbc..1160c45a 100644 --- a/www/lib/CoreLibs/Language/Core/CachedFileReader.php +++ b/www/lib/CoreLibs/Language/Core/CachedFileReader.php @@ -46,7 +46,7 @@ class CachedFileReader extends \CoreLibs\Language\Core\StringReader if (!is_resource($fd)) { $this->error = 3; // Cannot read file, probably permissions } else { - $this->fd_str = fread($fd, filesize($filename) ?: 0) ?: ''; + $this->fd_str = fread($fd, filesize($filename) ?: 1) ?: ''; fclose($fd); } } else { diff --git a/www/lib/CoreLibs/Template/SmartyExtend.php b/www/lib/CoreLibs/Template/SmartyExtend.php index c8cb48c5..94870661 100644 --- a/www/lib/CoreLibs/Template/SmartyExtend.php +++ b/www/lib/CoreLibs/Template/SmartyExtend.php @@ -185,7 +185,7 @@ class SmartyExtend extends \Smarty // call basic smarty // or Smarty::__construct(); parent::__construct(); - // iinit lang + // init lang $this->l10n = $l10n; // parse and read, legacy stuff $locale = $this->l10n->getLocaleAsArray();