Title: PHP Warning: preg_split() expects parameter 2 to be string, array given
Last modified: October 31, 2020

---

# PHP Warning: preg_split() expects parameter 2 to be string, array given

 *  Resolved [hiroprot](https://wordpress.org/support/users/hiroprot/)
 * (@hiroprot)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/php-warning-preg_split-expects-parameter-2-to-be-string-array-given/)
 * Hi Jeff,
 * I reported this issue a while ago with another one [here](https://wordpress.org/support/topic/php-warnings-with-to-acf-pro/).
   That second problem was fixed, but this one persists even with version 2.5 of
   the plugin.
 * Full message in Apache’s `error.log`:
 * `preg_split() expects parameter 2 to be string, array given in /wp-content/plugins/
   prismatic/inc/prismatic-core.php on line 56`
 * and
 * `PHP Warning: count(): Parameter must be an array or an object that implements
   Countable in /wp-content/plugins/prismatic/inc/prismatic-core.php on line 57`
 * This is what line 56 of `prismatic-core.php` looks like:
 * `$split = preg_split("/(\[prismatic_encoded.*\].*\[\/prismatic_encoded\])/Us",
   $text, -1, PREG_SPLIT_DELIM_CAPTURE);`
 * Apparently, the variable `$text` may contain an array in certain cases.
 * Note: as indicated in my earlier post, this might occur in conjunction with ACF
   Pro.
    -  This topic was modified 5 years, 7 months ago by [hiroprot](https://wordpress.org/support/users/hiroprot/).
    -  This topic was modified 5 years, 7 months ago by [hiroprot](https://wordpress.org/support/users/hiroprot/).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/php-warning-preg_split-expects-parameter-2-to-be-string-array-given/#post-13605598)
 * Thanks have added to the to-do list and will try to resolve for the next update.
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-preg_split-expects-parameter-2-to-be-string-array-given/#post-13646476)
 * I *think* I’ve got this fixed in the next version of the plugin. Should be available
   this week.
 * Note that I don’t have ACF Pro, so can’t really test the results. But I improved
   the code logic and think it should be sorted. Please test and let me know either
   way. Thank you.
 *  Thread Starter [hiroprot](https://wordpress.org/support/users/hiroprot/)
 * (@hiroprot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-preg_split-expects-parameter-2-to-be-string-array-given/#post-13646629)
 * Awesome, thank you so much! This should get my Apache server errors down from
   ~1000 per week to less than ten (I hope).
 * I’ll let you know if I notice anything after upgrading.
 *  Thread Starter [hiroprot](https://wordpress.org/support/users/hiroprot/)
 * (@hiroprot)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-preg_split-expects-parameter-2-to-be-string-array-given/#post-13694008)
 * I am happy to confirm that version 2.6 fixes the issue. The number of errors 
   in the Apache log went down from nearly 1,000 to 60 per week, and those remaining
   60 have nothing to do with this awesome plugin.
 * Thanks, Jeff!
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-preg_split-expects-parameter-2-to-be-string-array-given/#post-13694816)
 * You are very welcome, [@hiroprot](https://wordpress.org/support/users/hiroprot/)!
    -  This reply was modified 5 years, 6 months ago by [Jeff Starr](https://wordpress.org/support/users/specialk/).
    -  This reply was modified 5 years, 6 months ago by [Jeff Starr](https://wordpress.org/support/users/specialk/).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP Warning: preg_split() expects parameter 2 to be string, array given’
is closed to new replies.

 * ![](https://ps.w.org/prismatic/assets/icon-256x256.png?rev=1521267)
 * [Prismatic](https://wordpress.org/plugins/prismatic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/prismatic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/prismatic/)
 * [Active Topics](https://wordpress.org/support/plugin/prismatic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/prismatic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/prismatic/reviews/)

## Tags

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

 * 5 replies
 * 2 participants
 * Last reply from: [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/php-warning-preg_split-expects-parameter-2-to-be-string-array-given/#post-13694816)
 * Status: resolved