cvs: php-src /ext/json/tests bug42785.phpt

From: Date: Mon, 01 Oct 2007 15:33:29 +0000
Subject: cvs: php-src /ext/json/tests bug42785.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-46410@lists.php.net to get a copy of this message
iliaa Mon Oct 1 15:33:29 2007 UTC Modified files: /php-src/ext/json/tests bug42785.phpt Log: MFB: Added test for bug #42785 http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug42785.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/json/tests/bug42785.phpt diff -u /dev/null php-src/ext/json/tests/bug42785.phpt:1.2 --- /dev/null Mon Oct 1 15:33:29 2007 +++ php-src/ext/json/tests/bug42785.phpt Mon Oct 1 15:33:29 2007 @@ -0,0 +1,26 @@ +--TEST-- +Bug #42785 (Incorrect formatting of double values with non-english locales) +--SKIPIF-- +<?php + if (!extension_loaded("json")) { + print "skip"; + } else if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) { + die("skip locale needed for this test is not supported on this platform"); + } +?> +--FILE-- +<?php +setlocale(LC_ALL, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1"); + +$foo = Array(100.10,"bar"); +var_dump(json_encode($foo)); + +Class bar {} +$bar1 = new bar; +$bar1->a = 100.10; +$bar1->b = "foo"; +var_dump(json_encode($bar1)); +?> +--EXPECT-- +string(13) "[100.1,"bar"]" +string(21) "{"a":100.1,"b":"foo"}"

« previous php.cvs (#46410) next »