[wp-trac] [WordPress Trac] #48605: add_magic_quotes() inappropriately recasts data types

WordPress Trac noreply at wordpress.org
Tue May 19 15:06:57 UTC 2020


#48605: add_magic_quotes() inappropriately recasts data types
--------------------------------------------+-----------------------------
 Reporter:  Veraxus                         |       Owner:  SergeyBiryukov
     Type:  defect (bug)                    |      Status:  reviewing
 Priority:  normal                          |   Milestone:  5.5
Component:  Bootstrap/Load                  |     Version:  5.4
 Severity:  major                           |  Resolution:
 Keywords:  has-patch early has-unit-tests  |     Focuses:
--------------------------------------------+-----------------------------
Changes (by donmhico):

 * keywords:  has-patch early needs-unit-tests => has-patch early has-unit-
     tests


Comment:

 In https://github.com/WordPress/wordpress-develop/pull/284/files, I added
 the `! is_string( $v )` check after the `is_array( $v )` compared to
 https://core.trac.wordpress.org/attachment/ticket/48605/48605-fix-add-
 magic-quotes.patch because otherwise it won't perform `addslashes()` in
 the strings inside a subarray.
 Example
 {{{#!php
 <?php
 $data = [
     1,
     'This is a "string"',
     [
         true,
         null,
         525,
         'This is another "string"', // This won't be passed to
 `addslashes()` in 48605-fix-add-magic-quotes.patch
     ],
 ];
 }}}

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


More information about the wp-trac mailing list