com php-src: Add test for fixed bug #68992: ext/json/tests/bug68992.phpt

From: Date: Mon, 29 Aug 2016 13:49:40 +0000
Subject: com php-src: Add test for fixed bug #68992: ext/json/tests/bug68992.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94106@lists.php.net to get a copy of this message
Commit: 27acbcf4df1ddac593f37fc4f9bb30fdfb456377 Author: Jakub Zelenka <bukka@php.net> Sun, 28 Aug 2016 13:00:49 +0100 Parents: df05dbb3dfa0b55b25ff499c7e1646928279952d Branches: PHP-7.1 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=27acbcf4df1ddac593f37fc4f9bb30fdfb456377 Log: Add test for fixed bug #68992 Bugs: https://bugs.php.net/68992 Changed paths: A ext/json/tests/bug68992.phpt Diff: diff --git a/ext/json/tests/bug68992.phpt b/ext/json/tests/bug68992.phpt new file mode 100644 index 0000000..0fc41ec --- /dev/null +++ b/ext/json/tests/bug68992.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #68992 (json_encode stacks exceptions thrown by JsonSerializable classes) +--SKIPIF-- +<?php +if (!extension_loaded('json')) die('skip'); +?> +--FILE-- +<?php + +class MyClass implements JsonSerializable { + public function jsonSerialize() { + throw new Exception('Not implemented!'); + } +} +$classes = []; +for($i = 0; $i < 5; $i++) { + $classes[] = new MyClass(); +} + +try { + json_encode($classes); +} catch(Exception $e) { + do { + printf("%s (%d) [%s]\n", $e->getMessage(), $e->getCode(), get_class($e)); + } while ($e = $e->getPrevious()); +} +?> +--EXPECT-- +Failed calling MyClass::jsonSerialize() (0) [Exception] +Not implemented! (0) [Exception]

« previous php.cvs (#94106) next »