diff options
Diffstat (limited to 'ext/standard/tests/general_functions')
29 files changed, 690 insertions, 340 deletions
diff --git a/ext/standard/tests/general_functions/bug70018.phpt b/ext/standard/tests/general_functions/bug70018.phpt new file mode 100644 index 0000000000..d4c38b9d8a --- /dev/null +++ b/ext/standard/tests/general_functions/bug70018.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #70018 (exec does not strip all whitespace) +--SKIPIF-- +<?php +if ("cli" != php_sapi_name()) { + die("skip.. CLI only test"); +} +?> +--FILE-- +<?php +$output = array(); + +$test_fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . md5(uniqid()); +file_put_contents($test_fl, '<?php echo "abc\f\n \n";'); + +exec(PHP_BINARY . " -n $test_fl", $output); + +var_dump($output); + +@unlink($test_fl); +?> +--EXPECT-- +array(2) { + [0]=> + string(3) "abc" + [1]=> + string(0) "" +} diff --git a/ext/standard/tests/general_functions/bug70157.phpt b/ext/standard/tests/general_functions/bug70157.phpt new file mode 100644 index 0000000000..f593682051 --- /dev/null +++ b/ext/standard/tests/general_functions/bug70157.phpt @@ -0,0 +1,29 @@ +--TEST-- +parse_ini_string() crashes on values starting with number or unquoted strings +--FILE-- +<?php + +$contents = <<<EOS +[agatha.christie] +title = 10 little indians +foo[123] = E_ALL & ~E_DEPRECATED +foo[456] = 123 +EOS; + +var_dump(parse_ini_string($contents, false, INI_SCANNER_TYPED)); + +?> +Done +--EXPECTF-- +array(%d) { + ["title"]=> + string(%d) "10 little indians" + ["foo"]=> + array(%d) { + [123]=> + string(%d) "24575" + [456]=> + int(123) + } +} +Done diff --git a/ext/standard/tests/general_functions/bug70249.phpt b/ext/standard/tests/general_functions/bug70249.phpt new file mode 100644 index 0000000000..743df83ba0 --- /dev/null +++ b/ext/standard/tests/general_functions/bug70249.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #70249 (Segmentation fault while running PHPUnit tests on phpBB 3.2-dev) +--FILE-- +<?php + +class Logger { + public function __construct() { + register_shutdown_function(function () { + // make regular flush before other shutdown functions, which allows session data collection and so on + $this->flush(); + // make sure log entries written by shutdown functions are also flushed + // ensure "flush()" is called last when there are multiple shutdown functions + register_shutdown_function([$this, 'flush'], true); + }); + } + + public function flush($final = false) { + return 1; + } +} + +for ($i = 0; $i < 200; $i++) { + $a = new Logger(); +} +?> +okey +--EXPECT-- +okey diff --git a/ext/standard/tests/general_functions/bug70947.phpt b/ext/standard/tests/general_functions/bug70947.phpt new file mode 100644 index 0000000000..d07e5a331f --- /dev/null +++ b/ext/standard/tests/general_functions/bug70947.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #70947 (INI parser segfault with INI_SCANNER_TYPED) +--FILE-- +<?php +$o = parse_ini_string('foo = bar 123', FALSE, INI_SCANNER_TYPED); +var_dump($o); +?> +--EXPECT-- +array(1) { + ["foo"]=> + string(7) "bar 123" +} diff --git a/ext/standard/tests/general_functions/bug71891.phpt b/ext/standard/tests/general_functions/bug71891.phpt new file mode 100644 index 0000000000..b1f7e200d8 --- /dev/null +++ b/ext/standard/tests/general_functions/bug71891.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #71891 (header_register_callback() and register_shutdown_function()) +--FILE-- +<?php + +header_register_callback(function () { + echo 'header'; + register_shutdown_function(function () { + echo 'shutdown'; + }); +}); +?> +--EXPECT-- +header diff --git a/ext/standard/tests/general_functions/bug72300.phpt b/ext/standard/tests/general_functions/bug72300.phpt new file mode 100644 index 0000000000..94d1f20f8a --- /dev/null +++ b/ext/standard/tests/general_functions/bug72300.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #72300 (ignore_user_abort(false) has no effect) +--INI-- +ignore_user_abort=0 +--FILE-- +<?php + +var_dump(ignore_user_abort(true)); +var_dump(ignore_user_abort()); +var_dump(ini_get("ignore_user_abort")); +var_dump(ignore_user_abort(false)); +var_dump(ignore_user_abort()); +var_dump(ini_get("ignore_user_abort")); + +?> +--EXPECT-- +int(0) +int(1) +string(1) "1" +int(1) +int(0) +string(1) "0" diff --git a/ext/standard/tests/general_functions/connection_aborted.phpt b/ext/standard/tests/general_functions/connection_aborted.phpt new file mode 100644 index 0000000000..79618c2aa1 --- /dev/null +++ b/ext/standard/tests/general_functions/connection_aborted.phpt @@ -0,0 +1,10 @@ +--TEST-- +int connection_aborted ( void ); +--CREDITS-- +marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br +--FILE-- +<?php +var_dump(connection_aborted()); +?> +--EXPECTF-- +int(0) diff --git a/ext/standard/tests/general_functions/connection_status.phpt b/ext/standard/tests/general_functions/connection_status.phpt new file mode 100644 index 0000000000..5e0677fe27 --- /dev/null +++ b/ext/standard/tests/general_functions/connection_status.phpt @@ -0,0 +1,10 @@ +--TEST-- +int connection_status ( void ); +--CREDITS-- +marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br +--FILE-- +<?php +var_dump(connection_status() == CONNECTION_NORMAL); +?> +--EXPECTF-- +bool(true) diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt Binary files differindex 00ec7a88a4..ec8e0a66ed 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_b.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_b.phpt diff --git a/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt Binary files differindex 00180da1ac..4fe2f4c95b 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_b_64bit.phpt diff --git a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt index 1f2b7e155d..c06dff556d 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt @@ -120,36 +120,36 @@ echo "Done\n"; -- Iteration 1 -- object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -161,44 +161,44 @@ object(no_member_class)#%d (0) refcount(%d){ -- Iteration 3 -- object(contains_object_class)#%d (9) refcount(%d){ ["p"]=> - long(30) + int(30) ["p1":protected]=> - long(40) + int(40) ["p2":"contains_object_class":private]=> - long(50) + int(50) ["class_object1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -207,36 +207,36 @@ object(contains_object_class)#%d (9) refcount(%d){ ["class_object2"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -245,36 +245,36 @@ object(contains_object_class)#%d (9) refcount(%d){ ["class_object3":"contains_object_class":private]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -283,36 +283,36 @@ object(contains_object_class)#%d (9) refcount(%d){ ["class_object4":protected]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -324,44 +324,44 @@ object(contains_object_class)#%d (9) refcount(%d){ ["class_object5"]=> object(contains_object_class)#%d (9) refcount(%d){ ["p"]=> - long(30) + int(30) ["p1":protected]=> - long(40) + int(40) ["p2":"contains_object_class":private]=> - long(50) + int(50) ["class_object1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -370,36 +370,36 @@ object(contains_object_class)#%d (9) refcount(%d){ ["class_object2"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -408,36 +408,36 @@ object(contains_object_class)#%d (9) refcount(%d){ ["class_object3":"contains_object_class":private]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -446,36 +446,36 @@ object(contains_object_class)#%d (9) refcount(%d){ ["class_object4":protected]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -491,36 +491,36 @@ object(contains_object_class)#%d (9) refcount(%d){ -- Iteration 4 -- object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -529,36 +529,36 @@ object(object_class)#%d (6) refcount(%d){ -- Iteration 5 -- object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -572,36 +572,36 @@ NULL -- Iteration 8 -- object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -610,121 +610,121 @@ object(object_class)#%d (6) refcount(%d){ -- Iteration 9 -- object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (6) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* } } -- Iteration 10 -- -long(30) +int(30) -- Iteration 11 -- NULL -- Testing debug_zval_dump() on overwritten object variables -- -long(500) -long(500) -long(500) -long(500) +int(500) +int(500) +int(500) +int(500) -- Testing debug_zval_dump() on objects having circular reference -- object(object_class)#%d (7) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (7) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* ["obj"]=> &object(object_class)#%d (7) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (7) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -738,55 +738,55 @@ object(object_class)#%d (7) refcount(%d){ ["obj"]=> &object(object_class)#%d (7) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> object(object_class)#%d (7) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* ["obj"]=> &object(object_class)#%d (7) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* @@ -797,38 +797,38 @@ object(object_class)#%d (7) refcount(%d){ ["obj"]=> &object(object_class)#%d (7) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* ["obj"]=> &object(object_class)#%d (7) refcount(%d){ ["value1"]=> - long(5) + int(5) ["value2":"object_class":private]=> - long(10) + int(10) ["value3":protected]=> - long(20) + int(20) ["value4"]=> - long(30) + int(30) ["array_var"]=> array(2) refcount(%d){ ["key1"]=> - long(1) + int(1) ["key2 "]=> - long(3) + int(3) } ["object_class1"]=> *RECURSION* diff --git a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt index f4b768a77e..849d8b492c 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt @@ -124,27 +124,27 @@ echo "Done\n"; --- Variation 1: global variable inside a function --- -- Value of global variable, before calling dump_globalvar() -- -long(10) +int(10) -- Value of local variable inside dump_globalvar() -- -long(10) +int(10) -- Value of global variable inside dump_globalvar() -- -long(10) +int(10) -- Value of global variable, after exiting dump_globalvar() -- -long(10) +int(10) --- Variation 2: one variable references another --- -- Value of $first_var: -- -long(10) +int(10) -- Value of $ref_first_var -- NULL -- Value of $first_var -- -long(10) +int(10) -- Value of $ref_first_var -- @@ -152,18 +152,18 @@ Notice: Undefined variable: ref_first_var in %s on line %d NULL -- Value of $first_var -- -long(10) +int(10) --- Variation 3: multiple references of variables --- -- Value of $var_1: (before referencing) -- -long(10) +int(10) -- Value of $var_2: (referencing var_1) -- -long(10) +int(10) -- Value of $var_3: (referencing var_2) -- -long(10) +int(10) -- Value of $var_3: (after unsetting var_3) -- @@ -171,10 +171,10 @@ Notice: Undefined variable: var_3 in %s on line %d NULL -- Value of $var_2: -- -long(10) +int(10) -- Value of $var_3: -- -long(10) +int(10) -- Value of $var_1: (after unsetting variable_1) -- @@ -182,7 +182,7 @@ Notice: Undefined variable: var_1 in %s on line %d NULL -- Value of $var_2: -- -long(10) +int(10) *** Testing debug_zval_dump() on miscelleneous input arguments *** -- Iteration 1 -- diff --git a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt new file mode 100644 index 0000000000..cbb3f6fcc4 --- /dev/null +++ b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt @@ -0,0 +1,10 @@ +--TEST-- +Test escapeshellarg() string with \0 bytes +--FILE-- +<?php +escapeshellarg("hello\0world"); + +?> +===DONE=== +--EXPECTF-- +Fatal error: escapeshellarg(): Input string contains NULL bytes in %s on line %d diff --git a/ext/standard/tests/general_functions/escapeshellarg_bug71270.phpt b/ext/standard/tests/general_functions/escapeshellarg_bug71270.phpt new file mode 100644 index 0000000000..c57da3691c --- /dev/null +++ b/ext/standard/tests/general_functions/escapeshellarg_bug71270.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test escapeshellarg() allowed argument length +--FILE-- +<?php +ini_set('memory_limit', -1); +$var_2 = str_repeat('A', 1024*1024*64); +escapeshellarg($var_2); + +?> +===DONE=== +--EXPECTF-- +Fatal error: escapeshellarg(): Argument exceeds the allowed length of %d bytes in %s on line %d diff --git a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt new file mode 100644 index 0000000000..0a4d7eacff --- /dev/null +++ b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt @@ -0,0 +1,10 @@ +--TEST-- +Test escapeshellcmd() string with \0 bytes +--FILE-- +<?php +escapeshellcmd("hello\0world"); + +?> +===DONE=== +--EXPECTF-- +Fatal error: escapeshellcmd(): Input string contains NULL bytes in %s on line %d diff --git a/ext/standard/tests/general_functions/escapeshellcmd_bug71270.phpt b/ext/standard/tests/general_functions/escapeshellcmd_bug71270.phpt new file mode 100644 index 0000000000..4686193d41 --- /dev/null +++ b/ext/standard/tests/general_functions/escapeshellcmd_bug71270.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test escapeshellcmd() allowed argument length +--FILE-- +<?php +ini_set('memory_limit', -1); +$var_2 = str_repeat('A', 1024*1024*64); +escapeshellcmd($var_2); + +?> +===DONE=== +--EXPECTF-- +Fatal error: escapeshellcmd(): Command exceeds the allowed length of %d bytes in %s on line %d diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt index 9b7a3281e4..d7bdffd6ae 100644 --- a/ext/standard/tests/general_functions/floatval.phpt +++ b/ext/standard/tests/general_functions/floatval.phpt @@ -155,6 +155,10 @@ float(5000000) float(-5000000) *** Testing floatval() on non floating types *** + +Notice: A non well formed numeric value encountered in %s on line 69 + +Notice: A non well formed numeric value encountered in %s on line 70 float(-2147483648) float(2147483648) float(%d) diff --git a/ext/standard/tests/general_functions/floatval_variation1.phpt b/ext/standard/tests/general_functions/floatval_variation1.phpt index 83925b89b0..aa808cfba1 100644 --- a/ext/standard/tests/general_functions/floatval_variation1.phpt +++ b/ext/standard/tests/general_functions/floatval_variation1.phpt @@ -52,6 +52,11 @@ foreach ($not_float_types as $key => $type ) { ?> ===DONE=== --EXPECTF-- + +Notice: A non well formed numeric value encountered in %s on line %d + +Notice: A non well formed numeric value encountered in %s on line %d + *** Testing floatval() on non floating types *** -- Iteration : -2147483648 -- @@ -151,4 +156,4 @@ float(0) -- Iteration : null -- float(0) -===DONE===
\ No newline at end of file +===DONE=== diff --git a/ext/standard/tests/general_functions/getenv.phpt b/ext/standard/tests/general_functions/getenv.phpt new file mode 100644 index 0000000000..006378a337 --- /dev/null +++ b/ext/standard/tests/general_functions/getenv.phpt @@ -0,0 +1,16 @@ +--TEST-- +getenv() basic tests +--ENV-- +FOO=bar +--FILE-- +<?php + +var_dump(getenv("FOO")); +var_dump(getenv()["FOO"]); + +echo "Done\n"; +?> +--EXPECTF-- +string(3) "bar" +string(3) "bar" +Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt index 2242952769..18b05b6a97 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt @@ -282,7 +282,7 @@ string(7) "integer" -- Iteration 18 -- string(6) "string" bool(true) -int(1) +int(100) string(7) "integer" -- Iteration 19 -- string(6) "string" @@ -297,7 +297,7 @@ string(7) "integer" -- Iteration 21 -- string(6) "string" bool(true) -int(-1) +int(0) string(7) "integer" -- Iteration 22 -- string(6) "string" @@ -312,7 +312,7 @@ string(7) "integer" -- Iteration 24 -- string(6) "string" bool(true) -int(1) +int(100) string(7) "integer" -- Iteration 25 -- string(6) "string" @@ -327,7 +327,7 @@ string(7) "integer" -- Iteration 27 -- string(6) "string" bool(true) -int(-1) +int(0) string(7) "integer" -- Iteration 28 -- string(6) "string" @@ -687,7 +687,7 @@ string(7) "integer" -- Iteration 18 -- string(6) "string" bool(true) -int(1) +int(100) string(7) "integer" -- Iteration 19 -- string(6) "string" @@ -702,7 +702,7 @@ string(7) "integer" -- Iteration 21 -- string(6) "string" bool(true) -int(-1) +int(0) string(7) "integer" -- Iteration 22 -- string(6) "string" @@ -717,7 +717,7 @@ string(7) "integer" -- Iteration 24 -- string(6) "string" bool(true) -int(1) +int(100) string(7) "integer" -- Iteration 25 -- string(6) "string" @@ -732,7 +732,7 @@ string(7) "integer" -- Iteration 27 -- string(6) "string" bool(true) -int(-1) +int(0) string(7) "integer" -- Iteration 28 -- string(6) "string" diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt index 01ee023e5c..e5b630a839 100644 --- a/ext/standard/tests/general_functions/print_r.phpt +++ b/ext/standard/tests/general_functions/print_r.phpt @@ -442,9 +442,9 @@ Array *** Testing print_r() on float variables *** -- Iteration 1 -- -0 -0 -0 +-0 +-0 +-0 -- Iteration 2 -- 0 0 @@ -1605,7 +1605,7 @@ Array -- Iteration 4 -- Array ( - [0] => 0 + [0] => -0 [1] => Where am I? [2] => Array ( @@ -1621,7 +1621,7 @@ Array Array ( - [0] => 0 + [0] => -0 [1] => Where am I? [2] => Array ( @@ -1637,7 +1637,7 @@ Array Array ( - [0] => 0 + [0] => -0 [1] => Where am I? [2] => Array ( diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt index d62b3f9790..40f44ea1e4 100644 --- a/ext/standard/tests/general_functions/print_r_64bit.phpt +++ b/ext/standard/tests/general_functions/print_r_64bit.phpt @@ -443,9 +443,9 @@ Array *** Testing print_r() on float variables *** -- Iteration 1 -- -0 -0 -0 +-0 +-0 +-0 -- Iteration 2 -- 0 0 @@ -1606,7 +1606,7 @@ Array -- Iteration 4 -- Array ( - [0] => 0 + [0] => -0 [1] => Where am I? [2] => Array ( @@ -1622,7 +1622,7 @@ Array Array ( - [0] => 0 + [0] => -0 [1] => Where am I? [2] => Array ( @@ -1638,7 +1638,7 @@ Array Array ( - [0] => 0 + [0] => -0 [1] => Where am I? [2] => Array ( diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt index be8c648d3a..9821e95eaa 100644 --- a/ext/standard/tests/general_functions/var_dump.phpt +++ b/ext/standard/tests/general_functions/var_dump.phpt @@ -368,7 +368,7 @@ float(-2147483648) *** Testing var_dump() on float variables *** -- Iteration 1 -- -float(0) +float(-0) -- Iteration 2 -- float(0) -- Iteration 3 -- @@ -893,7 +893,7 @@ array(4) { -- Iteration 4 -- array(6) { [0]=> - float(0) + float(-0) [1]=> string(11) "Where am I?" [2]=> @@ -1022,7 +1022,7 @@ array(15) { } array(32) { [0]=> - float(0) + float(-0) [1]=> float(0) [2]=> @@ -1519,7 +1519,7 @@ array(6) { [3]=> array(6) { [0]=> - float(0) + float(-0) [1]=> string(11) "Where am I?" [2]=> diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt index 3672357936..6bbbb3f51d 100644 --- a/ext/standard/tests/general_functions/var_dump_64bit.phpt +++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt @@ -368,7 +368,7 @@ int(-2147483648) *** Testing var_dump() on float variables *** -- Iteration 1 -- -float(0) +float(-0) -- Iteration 2 -- float(0) -- Iteration 3 -- @@ -893,7 +893,7 @@ array(4) { -- Iteration 4 -- array(6) { [0]=> - float(0) + float(-0) [1]=> string(11) "Where am I?" [2]=> @@ -1022,7 +1022,7 @@ array(15) { } array(32) { [0]=> - float(0) + float(-0) [1]=> float(0) [2]=> @@ -1519,7 +1519,7 @@ array(6) { [3]=> array(6) { [0]=> - float(0) + float(-0) [1]=> string(11) "Where am I?" [2]=> diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt index 1cadb4aa55..47dfcbb3ee 100644 --- a/ext/standard/tests/general_functions/var_export-locale.phpt +++ b/ext/standard/tests/general_functions/var_export-locale.phpt @@ -30,12 +30,12 @@ $valid_ints = array( '0x12ab', '0Xfff', '0XFA', - -0x80000000, // max negative integer as hexadecimal + -0x7fffffff - 1, // max negative integer as hexadecimal '0x7fffffff', // max positive integer as hexadecimal 0x7FFFFFFF, // max positive integer as hexadecimal '0123', // integer as octal 01, // should be quivalent to octal 1 - -020000000000, // max negative integer as octal + -017777777777 - 1, // max negative integer as octal 017777777777, // max positive integer as octal ); $counter = 1; @@ -79,12 +79,12 @@ $counter++; echo "*** Testing var_export() with valid float values ***\n"; // different valid float vlaues $valid_floats = array( - -2147483649, // float value - 2147483648, // float value - -0x80000001, // float value, beyond max negative int - 0x800000001, // float value, beyond max positive int - 020000000001, // float value, beyond max positive int - -020000000001, // float value, beyond max negative int + (float)-2147483649, // float value + (float)2147483648, // float value + (float)-0x80000001, // float value, beyond max negative int + (float)0x800000001, // float value, beyond max positive int + (float)020000000001, // float value, beyond max positive int + (float)-020000000001, // float value, beyond max negative int 0.0, -0.1, 10.0000000000000000005, @@ -103,7 +103,7 @@ $valid_floats = array( $counter = 1; /* Loop to check for above float values with var_export() */ echo "\n*** Output for float values ***\n"; -foreach($valid_bool as $float_value) { +foreach($valid_floats as $float_value) { echo "\nIteration ".$counter."\n"; var_export( $float_value ); echo "\n"; @@ -467,39 +467,123 @@ string(5) "false" *** Output for float values *** Iteration 1 -1 -1 -string(1) "1" +-2147483649.0 +-2147483649.0 +string(13) "-2147483649.0" Iteration 2 -true -true -string(4) "true" +2147483648.0 +2147483648.0 +string(12) "2147483648.0" Iteration 3 -true -true -string(4) "true" +-2147483649.0 +-2147483649.0 +string(13) "-2147483649.0" Iteration 4 -0 -0 -string(1) "0" +34359738369.0 +34359738369.0 +string(13) "34359738369.0" Iteration 5 -false -false -string(5) "false" +2147483649.0 +2147483649.0 +string(12) "2147483649.0" Iteration 6 -false -false -string(5) "false" +-2147483649.0 +-2147483649.0 +string(13) "-2147483649.0" + + +Iteration 7 +0.0 +0.0 +string(3) "0.0" + + +Iteration 8 +-0.10000000000000001 +-0.10000000000000001 +string(20) "-0.10000000000000001" + + +Iteration 9 +10.0 +10.0 +string(4) "10.0" + + +Iteration 10 +1050000.0 +1050000.0 +string(9) "1050000.0" + + +Iteration 11 +100000.0 +100000.0 +string(8) "100000.0" + + +Iteration 12 +1.0000000000000001E-5 +1.0000000000000001E-5 +string(21) "1.0000000000000001E-5" + + +Iteration 13 +100000.0 +100000.0 +string(8) "100000.0" + + +Iteration 14 +100000.0 +100000.0 +string(8) "100000.0" + + +Iteration 15 +100000.0 +100000.0 +string(8) "100000.0" + + +Iteration 16 +1.0000000000000001E-5 +1.0000000000000001E-5 +string(21) "1.0000000000000001E-5" + + +Iteration 17 +5000000.0 +5000000.0 +string(9) "5000000.0" + + +Iteration 18 +6.0000000000000006E-20 +6.0000000000000006E-20 +string(22) "6.0000000000000006E-20" + + +Iteration 19 +5.0000000000000001E+42 +5.0000000000000001E+42 +string(22) "5.0000000000000001E+42" + + +Iteration 20 +3.4000000000000001E-33 +3.4000000000000001E-33 +string(22) "3.4000000000000001E-33" *** Testing var_export() with valid strings *** diff --git a/ext/standard/tests/general_functions/var_export_basic1.phpt b/ext/standard/tests/general_functions/var_export_basic1.phpt index cba04b8507..5f7b89124c 100644 --- a/ext/standard/tests/general_functions/var_export_basic1.phpt +++ b/ext/standard/tests/general_functions/var_export_basic1.phpt @@ -22,12 +22,12 @@ $valid_ints = array( "'0x12ab'" => '0x12ab', "'0Xfff'" => '0Xfff', "'0XFA'" => '0XFA', - "-0x80000000" => -0x80000000, // max negative integer as hexadecimal + "-0x80000000" => -0x7FFFFFFF - 1, // max negative integer as hexadecimal "'0x7fffffff'" => '0x7fffffff', // max positive integer as hexadecimal "0x7FFFFFFF" => 0x7FFFFFFF, // max positive integer as hexadecimal "'0123'" => '0123', // integer as octal "01912" => 01, // should be quivalent to octal 1 - "-020000000000" => -020000000000, // max negative integer as octal + "-020000000000" => -017777777777 - 1, // max negative integer as octal "017777777777" => 017777777777, // max positive integer as octal ); diff --git a/ext/standard/tests/general_functions/var_export_basic3.phpt b/ext/standard/tests/general_functions/var_export_basic3.phpt index 58c0448167..35692ad627 100644 --- a/ext/standard/tests/general_functions/var_export_basic3.phpt +++ b/ext/standard/tests/general_functions/var_export_basic3.phpt @@ -13,12 +13,12 @@ serialize_precision=17 echo "*** Testing var_export() with valid float values ***\n"; // different valid float vlaues $valid_floats = array( - "-2147483649" => -2147483649, // float value - "2147483648" => 2147483648, // float value - "-0x80000001" => -0x80000001, // float value, beyond max negative int - "0x800000001" => 0x800000001, // float value, beyond max positive int - "020000000001" => 020000000001, // float value, beyond max positive int - "-020000000001" => -020000000001, // float value, beyond max negative int + "-2147483649" => (float)-2147483649, // float value + "2147483648" => (float)2147483648, // float value + "-0x80000001" => (float)-0x80000001, // float value, beyond max negative int + "0x800000001" => (float)0x800000001, // float value, beyond max positive int + "020000000001" => (float)020000000001, // float value, beyond max positive int + "-020000000001" => (float)-020000000001, // float value, beyond max negative int "0.0" => 0.0, "-0.1" => -0.1, "10.0000000000000000005" => 10.0000000000000000005, @@ -54,45 +54,45 @@ foreach($valid_floats as $key => $float_value) { *** Output for float values *** -- Iteration: -2147483649 -- --2147483649 --2147483649 -string(11) "-2147483649" +-2147483649.0 +-2147483649.0 +string(13) "-2147483649.0" -- Iteration: 2147483648 -- -2147483648 -2147483648 -string(10) "2147483648" +2147483648.0 +2147483648.0 +string(12) "2147483648.0" -- Iteration: -0x80000001 -- --2147483649 --2147483649 -string(11) "-2147483649" +-2147483649.0 +-2147483649.0 +string(13) "-2147483649.0" -- Iteration: 0x800000001 -- -34359738369 -34359738369 -string(11) "34359738369" +34359738369.0 +34359738369.0 +string(13) "34359738369.0" -- Iteration: 020000000001 -- -2147483649 -2147483649 -string(10) "2147483649" +2147483649.0 +2147483649.0 +string(12) "2147483649.0" -- Iteration: -020000000001 -- --2147483649 --2147483649 -string(11) "-2147483649" +-2147483649.0 +-2147483649.0 +string(13) "-2147483649.0" -- Iteration: 0.0 -- -0 -0 -string(1) "0" +0.0 +0.0 +string(3) "0.0" -- Iteration: -0.1 -- @@ -102,21 +102,21 @@ string(20) "-0.10000000000000001" -- Iteration: 10.0000000000000000005 -- -10 -10 -string(2) "10" +10.0 +10.0 +string(4) "10.0" -- Iteration: 10.5e+5 -- -1050000 -1050000 -string(7) "1050000" +1050000.0 +1050000.0 +string(9) "1050000.0" -- Iteration: 1e5 -- -100000 -100000 -string(6) "100000" +100000.0 +100000.0 +string(8) "100000.0" -- Iteration: 1e-5 -- @@ -126,21 +126,21 @@ string(21) "1.0000000000000001E-5" -- Iteration: 1e+5 -- -100000 -100000 -string(6) "100000" +100000.0 +100000.0 +string(8) "100000.0" -- Iteration: 1E5 -- -100000 -100000 -string(6) "100000" +100000.0 +100000.0 +string(8) "100000.0" -- Iteration: 1E+5 -- -100000 -100000 -string(6) "100000" +100000.0 +100000.0 +string(8) "100000.0" -- Iteration: 1E-5 -- @@ -150,9 +150,9 @@ string(21) "1.0000000000000001E-5" -- Iteration: .5e+7 -- -5000000 -5000000 -string(7) "5000000" +5000000.0 +5000000.0 +string(9) "5000000.0" -- Iteration: .6e-19 -- diff --git a/ext/standard/tests/general_functions/var_export_bug66179.phpt b/ext/standard/tests/general_functions/var_export_bug66179.phpt new file mode 100644 index 0000000000..15952199e5 --- /dev/null +++ b/ext/standard/tests/general_functions/var_export_bug66179.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #66179 (var_export() exports float as integer) +--FILE-- +<?php + +var_export(1.0); +echo PHP_EOL; +var_export(123.0); +echo PHP_EOL; +var_export(-1.0); +echo PHP_EOL; +var_export(-123.0); +echo PHP_EOL; +var_export(0.0); +echo PHP_EOL; +var_export(-0.0); +echo PHP_EOL; +var_export(10000000000000000.0); +echo PHP_EOL; + +?> +--EXPECTF-- +1.0 +123.0 +-1.0 +-123.0 +0.0 +-0.0 +10000000000000000.0 diff --git a/ext/standard/tests/general_functions/var_export_bug71314.phpt b/ext/standard/tests/general_functions/var_export_bug71314.phpt new file mode 100644 index 0000000000..aaa8f794c0 --- /dev/null +++ b/ext/standard/tests/general_functions/var_export_bug71314.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #71314 (var_export(INF) prints INF.0) +--FILE-- +<?php + +var_export(INF); +echo PHP_EOL; +var_export(-INF); +echo PHP_EOL; +var_export(NAN); +echo PHP_EOL; +--EXPECT-- +INF +-INF +NAN |