Repository: yiisoft/yii (language: php)

Issue:
PHP 8.1 CPgsqlSchema error stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated
<!--
Note that only PHP 7 and PHP 8 compatibility issues are accepted. For security issues contact maintainers privately.
-->

### What steps will reproduce the problem?
with Postgres Database configured
$model->find();

### What is the expected result?


### What do you get instead?
an error: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated
CPgsqlSchema.php:194

### Additional info
adsrc is null when there's not a column default value, and stripos can't receive null

| Q                | A
| ---------------- | ---
| Yii version      | 1.1.25
| PHP version      | 8.1
| Operating system | macOS


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG b/CHANGELOG
index 974ee85bdd..6b30039d0a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@ Version 1.1.26 under development
 - Enh #4386: Updated HTMLPurifier to version 4.14.0-master-1dd3e52 for PHP 8.1 support (https://github.com/ezyang/htmlpurifier/blob/v4.14.0/NEWS) (marcovtwout)
 - Enh #4392: Added support for SSL to CRedisCache (andres101)
 - Bug #4453: Alpine Linux compatibility: Avoid using `GLOB_BRACE` in `CFileHelper::removeDirectory` (ivany4)
+- Bug #4456: PHP 8.1 compatibility: Fix stripos() parameter #1 null deprecation in `CPgsqlSchema::findColumns` (JonathanArgentao)
 
 Version 1.1.25 December 13, 2021
 --------------------------------
diff --git a/framework/db/schema/pgsql/CPgsqlSchema.php b/framework/db/schema/pgsql/CPgsqlSchema.php
index 12949b24bc..47affac9ac 100644
--- a/framework/db/schema/pgsql/CPgsqlSchema.php
+++ b/framework/db/schema/pgsql/CPgsqlSchema.php
@@ -191,7 +191,7 @@ protected function findColumns($table)
 			$c=$this->createColumn($column);
 			$table->columns[$c->name]=$c;
 
-			if(stripos($column['adsrc'],'nextval')===0 && preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i',$column['adsrc'],$matches))
+			if(isset($column['adsrc']) && stripos($column['adsrc'],'nextval')===0 && preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i',$column['adsrc'],$matches))
 			{
 				if(strpos($matches[1],'.')!==false || $table->schemaName===self::DEFAULT_SCHEMA)
 					$this->_sequences[$table->rawName.'.'.$c->name]=$matches[1];


Test patch: