Title: PHP Deprecated: preg_split()
Last modified: May 14, 2024

---

# PHP Deprecated: preg_split()

 *  [Pedro Candeias](https://wordpress.org/support/users/nervo/)
 * (@nervo)
 * [2 years ago](https://wordpress.org/support/topic/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 the `preg_split` function’s `$limit` 
   parameter is deprecated. The `preg_split` function expects an integer for the`
   $limit` parameter.
 * In your function, `preg_split('~(\?[nsiuap])~u',$raw,null,PREG_SPLIT_DELIM_CAPTURE);`
   uses `null` for the `$limit` parameter. To fix this, you can change `null` to`-
   1`, which is the default value indicating no limit.
 * This is the culprit:
 *     ```wp-block-code
       private function prepareQuery($args)
   
       {
   
       ....
   
       $array = preg_split('~(\?[nsiuap])~u',$raw,null,PREG_SPLIT_DELIM_CAPTURE);
   
       ...
   
       }
       ```
   
 * And this is a workaround:
 *     ```wp-block-code
       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.

 * ![](https://s.w.org/plugins/geopattern-icon/flow-flow-social-streams_a9b2da.svg)
 * [Flow-Flow Social Feed Stream](https://wordpress.org/plugins/flow-flow-social-streams/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/flow-flow-social-streams/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/flow-flow-social-streams/)
 * [Active Topics](https://wordpress.org/support/plugin/flow-flow-social-streams/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/flow-flow-social-streams/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/flow-flow-social-streams/reviews/)

## Tags

 * [deprecated](https://wordpress.org/support/topic-tag/deprecated/)

 * 0 replies
 * 1 participant
 * Last reply from: [Pedro Candeias](https://wordpress.org/support/users/nervo/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/php-deprecated-preg_split/)
 * Status: not a support question