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
null
to thepreg_split
function’s$limit
parameter is deprecated. Thepreg_split
function expects an integer for the$limit
parameter.In your function,
preg_split('~(\?[nsiuap])~u',$raw,null,PREG_SPLIT_DELIM_CAPTURE);
usesnull
for the$limit
parameter. To fix this, you can changenull
to-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.