Title: PHP warning: Deprecated: preg_replace()
Last modified: June 28, 2024

---

# PHP warning: Deprecated: preg_replace()

 *  Resolved [scottsawyer](https://wordpress.org/support/users/scottsawyer/)
 * (@scottsawyer)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/)
 * I have a single text field on a product, no special configuration, just a label.
   I get the following warning:
 * > Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type
   > array|string is deprecated in /app/wp-includes/formatting.php on line 2431
 * PHP 8.1
 * WordPress 6.5.3
 * Plugin version: 1.6.8

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

 *  Plugin Author [Wombat Plugins](https://wordpress.org/support/users/maartenbelmans/)
 * (@maartenbelmans)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-17856620)
 * Hi [@scottsawyer](https://wordpress.org/support/users/scottsawyer/) 
   Can you 
   send us the following info:1) The full error. What you’ve shown us now is only
   part of it, but error messages come with a “stack trace” that show where it originates
   from.2) Screenshots of your configuration of the field.
 *  Plugin Author [Wombat Plugins](https://wordpress.org/support/users/maartenbelmans/)
 * (@maartenbelmans)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-17879160)
 * Closing this issue due to inactivity. Feel free to reply if this is still an 
   issue.
 *  [reinventatuweb](https://wordpress.org/support/users/reinventatuweb/)
 * (@reinventatuweb)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-17915099)
 * Hi, same iusse.
 * PHP 8.1
   Plugin version 1.6.9
 *  Plugin Author [Wombat Plugins](https://wordpress.org/support/users/maartenbelmans/)
 * (@maartenbelmans)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-17915120)
 * Hi [@reinventatuweb](https://wordpress.org/support/users/reinventatuweb/) 
   Can
   you send us the full error log so we have the stack trace with more information?
 *  [Vitalicus](https://wordpress.org/support/users/vitalicus/)
 * (@vitalicus)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-17942859)
 * The same problem:
   **Deprecated**: preg_replace(): Passing null to parameter #
   3 ($subject) of type array|string is deprecated in **/mnt/sdb1/Dropbox/ateii.
   org/wp-includes/formatting.php** on line **4799**
 *  Plugin Author [Wombat Plugins](https://wordpress.org/support/users/maartenbelmans/)
 * (@maartenbelmans)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-17942887)
 * Hi [@vitalicus](https://wordpress.org/support/users/vitalicus/) Can you send 
   us the full error log so we have the stack trace with more information?
 *  Thread Starter [scottsawyer](https://wordpress.org/support/users/scottsawyer/)
 * (@scottsawyer)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-18032412)
 * I think I found it [https://plugins.trac.wordpress.org/browser/advanced-product-fields-for-woocommerce/trunk/includes/classes/class-html.php#L186](https://plugins.trac.wordpress.org/browser/advanced-product-fields-for-woocommerce/trunk/includes/classes/class-html.php#L186)
 * `implode(' ',array_merge(array_map('sanitize_html_class',$extra_classes,$classes))),`
 * Should be
 * `implode(' ',array_merge(array_map('sanitize_html_class',$extra_classes),$classes)),`
 *  Plugin Author [Wombat Plugins](https://wordpress.org/support/users/maartenbelmans/)
 * (@maartenbelmans)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-18032543)
 * Hi [@scottsawyer](https://wordpress.org/support/users/scottsawyer/) 
   You’re right!
   Thank you for catching that. I have fixed it and released an update. Updating
   to version 1.6.11 should fix the issue.Thanks again!
 *  Thread Starter [scottsawyer](https://wordpress.org/support/users/scottsawyer/)
 * (@scottsawyer)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-18036511)
 * Thank you, will test asap. I appreciate you jumping on this.

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

The topic ‘PHP warning: Deprecated: preg_replace()’ is closed to new replies.

 * ![](https://ps.w.org/advanced-product-fields-for-woocommerce/assets/icon-256x256.
   gif?rev=3347990)
 * [Advanced Product Fields (Product Addons) for WooCommerce](https://wordpress.org/plugins/advanced-product-fields-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-product-fields-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-product-fields-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-product-fields-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-product-fields-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-product-fields-for-woocommerce/reviews/)

 * 9 replies
 * 4 participants
 * Last reply from: [scottsawyer](https://wordpress.org/support/users/scottsawyer/)
 * Last activity: [1 year, 8 months ago](https://wordpress.org/support/topic/php-warning-deprecated-preg_replace/#post-18036511)
 * Status: resolved