[wp-trac] [WordPress Trac] #26153: test_json_encode_decode fails in PHP 5.4

WordPress Trac noreply at wordpress.org
Fri Nov 22 00:46:01 UTC 2013


#26153: test_json_encode_decode fails in PHP 5.4
-----------------------------+-----------------------------
 Reporter:  georgestephanis  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  low              |  Milestone:  Awaiting Review
Component:  Unit Tests       |    Version:  trunk
 Severity:  minor            |   Keywords:  has-patch
-----------------------------+-----------------------------
 test_json_encode_decode fails in PHP 5.4 because the PEAR JSON compat
 class doesn't declare isError as a static function on line 864.

 http://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-
 json.php#L864

 This really won't ever cause any actual problems because it's only there
 for compat with PHP 5.2, and static doesn't kick problems until 5.4 -- so
 it's just when running Unit Tests that the class is included and
 explicitly run that it can whine.

 Patch attempts to fix this, by just testing for both the functions
 json_encode and json_decode existing, and that they work properly.

 On 5.2, they will include the class automatically, and test cleanly.  On
 5.4, it'll just test the native functions.  This feels better to me than
 testing a class that won't ever be included, or modifying an imported
 class to add a `static` keyword.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26153>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list