[wp-trac] [WordPress Trac] #59195: deprecation notice triggered in post.php by passing null to parameter #2 in preg_match()

WordPress Trac noreply at wordpress.org
Thu Aug 24 20:01:52 UTC 2023


#59195: deprecation notice triggered in post.php by passing null to parameter #2 in
preg_match()
-------------------------------+-----------------------------
 Reporter:  nosilver4u         |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Media              |    Version:  6.3
 Severity:  normal             |   Keywords:
  Focuses:  php-compatibility  |
-------------------------------+-----------------------------
 I've trying to force myself to use PHP 8.2 to get our plugins into shape,
 but am still running into a deprecation notice in post.php when viewing
 the Media Library in list mode:

 {{{
 PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of
 type string is deprecated in /sites/test.example.com/files/wp-
 includes/post.php on line 3298
 }}}

 Checking if $real is true before preg_match() is run seems to fix this
 particular one, but maybe to be safe an is_string( $real ) should be run
 also?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59195>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list