PHP error

preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

/media/shnoulle/data/webdev/master/application/models/Token.php(314)

302         $token = $event->get('token');
303         return $token;
304     }
305 
306     /**
307      * Sanitize token show to the user (replace sanitize_helper sanitize_token)
308      * @param string $token to sanitize
309      * @return string sanitized token
310      */
311     public static function sanitizeToken($token)
312     {
313         // According to Yii doc : http://www.yiiframework.com/doc/api/1.1/CSecurityManager#generateRandomString-detail
314         return preg_replace('/[^0-9a-zA-Z_~]/', '', $token);
315     }
316 
317     /**
318      * Sanitize string for any attribute
319      * @param string $attribute to sanitize
320      * @return string sanitized attribute
321      */
322     public static function sanitizeAttribute($attribute)
323     {
324         // TODO: Use HTML Purifier?
325         return filter_var($attribute, @FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
326     }

Stack Trace

#0
+
 /media/shnoulle/data/webdev/master/application/models/Token.php(314): preg_replace("/[^0-9a-zA-Z_~]/", "", null)
309      * @return string sanitized token
310      */
311     public static function sanitizeToken($token)
312     {
313         // According to Yii doc : http://www.yiiframework.com/doc/api/1.1/CSecurityManager#generateRandomString-detail
314         return preg_replace('/[^0-9a-zA-Z_~]/', '', $token);
315     }
316 
317     /**
318      * Sanitize string for any attribute
319      * @param string $attribute to sanitize
#4
+
 /media/shnoulle/data/webdev/master/application/models/LSActiveRecord.php(454): CModel->validate()
449      */
450     public function encryptSave($runValidation = false)
451     {
452         // run validation on attribute values before encryption take place, it is impossible to validate encrypted values
453         if ($runValidation) {
454             if (!$this->validate()) {
455                 return false;
456             }
457         }
458 
459         // encrypt attributes
#5
+
 /media/shnoulle/data/webdev/master/application/controllers/admin/Tokens.php(2406): LSActiveRecord->encryptSave(true)
2401                                 $oToken->scenario = 'allowinvalidemail';
2402                             }
2403                             foreach ($aWriteArray as $key => $value) {
2404                                 $oToken->$key = $value;
2405                             }
2406                             if (!$oToken->encryptSave(true)) {
2407                                 $aModelErrorList[] = array('line' => $iRecordCount, 'errors' => CHtml::errorSummary($oToken, '', '', ['class' => 'text-start']));
2408                             } else {
2409                                 $bImportDone = true;
2410                             }
2411                         }
2024-04-26 19:18:06 nginx/1.22.1 Yii Framework/1.1.29