PHP Deprecated: preg_split()
-
PHP Deprecated: preg_split(): Passing null to parameter #3 ($limit) of type int is deprecated in db/SafeMySQL.php
In PHP 8.1 and later, passing
nullto thepreg_splitfunction’s$limitparameter is deprecated. Thepreg_splitfunction expects an integer for the$limitparameter.In your function,
preg_split('~(\?[nsiuap])~u',$raw,null,PREG_SPLIT_DELIM_CAPTURE);usesnullfor the$limitparameter. To fix this, you can changenullto-1, which is the default value indicating no limit.This is the culprit:
private function prepareQuery($args) { .... $array = preg_split('~(\?[nsiuap])~u',$raw,null,PREG_SPLIT_DELIM_CAPTURE); ... }And this is a workaround:
private function prepareQuery($args) { ... $array = preg_split('~(\?[nsiuap])~u', $raw, -1, PREG_SPLIT_DELIM_CAPTURE); ... }
The topic ‘PHP Deprecated: preg_split()’ is closed to new replies.