From 0259b72d878add86dea98f7ff1b327433eb6ab61 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Sat, 2 Apr 2022 12:38:25 +0700 Subject: [PATCH 1/4] Resolve #19327 --- framework/db/oci/Schema.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework/db/oci/Schema.php b/framework/db/oci/Schema.php index abf7f149cfc..9865e0cbfd6 100644 --- a/framework/db/oci/Schema.php +++ b/framework/db/oci/Schema.php @@ -426,7 +426,7 @@ protected function createColumn($column) ) { $defaultValue = substr($defaultValue, 1, -1); } else { - $defaultValue = trim($defaultValue); + $defaultValue = trim((string) $defaultValue); } } $c->defaultValue = $c->phpTypecast($defaultValue); @@ -594,9 +594,9 @@ protected function extractColumnType($column, $dbType, $precision, $scale, $leng */ protected function extractColumnSize($column, $dbType, $precision, $scale, $length) { - $column->size = trim($length) === '' ? null : (int) $length; - $column->precision = trim($precision) === '' ? null : (int) $precision; - $column->scale = trim($scale) === '' ? null : (int) $scale; + $column->size = trim((string) $length) === '' ? null : (int) $length; + $column->precision = trim((string) $precision) === '' ? null : (int) $precision; + $column->scale = trim((string) $scale) === '' ? null : (int) $scale; } /** From 80822044852069c8440678b0d5a1170d8f132b35 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Sat, 2 Apr 2022 14:25:59 +0700 Subject: [PATCH 2/4] cast from extracted column --- framework/db/oci/Schema.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/db/oci/Schema.php b/framework/db/oci/Schema.php index 9865e0cbfd6..6d5e7a1f174 100644 --- a/framework/db/oci/Schema.php +++ b/framework/db/oci/Schema.php @@ -414,7 +414,7 @@ protected function createColumn($column) if (stripos($column['DATA_DEFAULT'], 'timestamp') !== false) { $c->defaultValue = null; } else { - $defaultValue = $column['DATA_DEFAULT']; + $defaultValue = (string) $column['DATA_DEFAULT']; if ($c->type === 'timestamp' && $defaultValue === 'CURRENT_TIMESTAMP') { $c->defaultValue = new Expression('CURRENT_TIMESTAMP'); } else { @@ -426,7 +426,7 @@ protected function createColumn($column) ) { $defaultValue = substr($defaultValue, 1, -1); } else { - $defaultValue = trim((string) $defaultValue); + $defaultValue = trim($defaultValue); } } $c->defaultValue = $c->phpTypecast($defaultValue); From c30345805de353af6fcd81ad6a938c1a82923625 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Fri, 8 Apr 2022 07:33:54 +0700 Subject: [PATCH 3/4] Update CHANGELOG --- framework/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index ef0aa1915ef..c263aeccfda 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -14,6 +14,8 @@ Yii Framework 2 Change Log - Enh #19309: Optimize `yii\base\Model::attributes()` (WinterSilence) - Bug #19322: Revert force setting value to empty string in case it's `null` in `yii\validators\FilterValidator::validateAttribute()` (bizley) - Bug #19329: Fix `yii\web\GroupUrlRule` to properly normalize prefix (bizley) +- Bug #19237: Fix OCI PHP 8.1: trim(): Passing null to parameter #1 ($string) + of type string is deprecated (longthanhtran) 2.0.45 February 11, 2022 From b916d4cb024f3042e89da7c0aa6ae4dc691be33c Mon Sep 17 00:00:00 2001 From: Bizley Date: Fri, 8 Apr 2022 07:51:15 +0200 Subject: [PATCH 4/4] Update CHANGELOG.md --- framework/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index d8ebdb70aec..28d049479c1 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -18,7 +18,7 @@ Yii Framework 2 Change Log - Bug #19322: Revert force setting value to empty string in case it's `null` in `yii\validators\FilterValidator::validateAttribute()` (bizley) - Bug #19329: Fix `yii\web\GroupUrlRule` to properly normalize prefix (bizley) - Bug #19328: Passing null to parameter #1 ($string) of type string is deprecated in `yii\db\oci\Schema` (Arkeins) -- Bug #19237: Fix OCI PHP 8.1: trim(): Passing null to parameter #1 ($string) of type string is deprecated (longthanhtran) +- Bug #19237: Fix OCI PHP 8.1 passing `null` to trim() (longthanhtran) 2.0.45 February 11, 2022