PHP error

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

/srv/www/limesurvey6/application/models/Token.php(315)

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         $pattern = Yii::app()->getConfig("allowedcharacters_pattern_token");
315         return preg_replace($pattern, '', $token);
316     }
317 
318     /**
319      * Sanitize string for any attribute
320      * @param string $attribute to sanitize
321      * @return string sanitized attribute
322      */
323     public static function sanitizeAttribute($attribute)
324     {
325         // TODO: Use HTML Purifier?
326         return filter_var($attribute, @FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
327     }

Stack Trace

#0
+
 /srv/www/limesurvey6/application/models/Token.php(315): preg_replace("/[^0-9a-zA-Z_\-~]/", "", null)
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         $pattern = Yii::app()->getConfig("allowedcharacters_pattern_token");
315         return preg_replace($pattern, '', $token);
316     }
317 
318     /**
319      * Sanitize string for any attribute
320      * @param string $attribute to sanitize
#4
+
 /srv/www/limesurvey6/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
+
 /srv/www/limesurvey6/application/controllers/admin/Tokens.php(2435): LSActiveRecord->encryptSave(true)
2430                                 $oToken->scenario = 'allowinvalidemail';
2431                             }
2432                             foreach ($aWriteArray as $key => $value) {
2433                                 $oToken->$key = $value;
2434                             }
2435                             if (!$oToken->encryptSave(true)) {
2436                                 $aModelErrorList[] = array('line' => $iRecordCount, 'errors' => CHtml::errorSummary($oToken, '', '', ['class' => 'text-start']));
2437                             } else {
2438                                 $bImportDone = true;
2439                             }
2440                         }
2025-03-21 16:58:20 nginx/1.24.0 Yii Framework/1.1.30