[wp-trac] [WordPress Trac] #59716: Deprecated messages exporting post meta with meta_value null from PHP 8.1

WordPress Trac noreply at wordpress.org
Tue Oct 24 15:09:53 UTC 2023


#59716: Deprecated messages exporting post meta with meta_value null from PHP 8.1
--------------------------+------------------------------
 Reporter:  bobbingwide   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Export        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  php81         |     Focuses:
--------------------------+------------------------------

Comment (by bobbingwide):

 `wxr_cdata()` was written for WordPress 2.1.0
 In those days I would argue that `null` was accepted as a valid string: an
 empty one.

 Why can't the docblock be changed to reflect the fact that since PHP 8.1 a
 `null` value is also acceptable?

 In my opinion, PHP 8.1 caused the problem, and this is a valid solution
 that will reduce the amount of effort to deal with it.

 {{{

 plugins\oik-bwtrace\includes\bwtrace-actions.php(286:2)
 bw_trace_error_handler(1) 34 1 2023-10-24T12:41:18+00:00 2.461264 0.088387
 cf! 22965 187 2592 115343360/115343360 2048M F=2271 err default output
 handler,default output handler
 Array

     [0] => (integer) 8192
     [1] => (string) "Deprecated: strlen(): Passing null to parameter #1
 ($string) of type string is deprecated"
     [2] => (string) "\wp-includes\formatting.php"
     [3] => (integer) 885


 0. bw_lazy_backtrace \plugins\oik-bwtrace\libs\bwtrace.php:108 0
 1. bw_backtrace plugins\oik-bwtrace\includes\bwtrace-actions.php:293 0
 2. bw_trace_error_handler(8192,strlen(): Passing null to parameter #1
 ($string) of type string is deprecated,\wp-includes\formatting.php,885)
 \wp-includes\formatting.php:885 4
 3. seems_utf8(null) \wp-admin\includes\export.php:200 1
 4. wxr_cdata(null) \wp-admin\includes\export.php:629 1
 5. export_wp(array) \wp-admin\export.php:123 1
 }}}

 The line that leads to the error is:
 {{{
         <wp:meta_value><?php echo wxr_cdata( $meta->meta_value );
 ?></wp:meta_value>
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59716#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list