diff options
Diffstat (limited to 'ext/standard/tests')
40 files changed, 228 insertions, 633 deletions
diff --git a/ext/standard/tests/array/array_change_key_case_variation1.phpt b/ext/standard/tests/array/array_change_key_case_variation1.phpt index 86653930f1..cf73693965 100644 --- a/ext/standard/tests/array/array_change_key_case_variation1.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation1.phpt @@ -3,7 +3,7 @@ Test array_change_key_case() function : usage variations - Pass different data t --FILE-- <?php /* Prototype : array array_change_key_case(array $input [, int $case]) - * Description: Retuns an array with all string keys lowercased [or uppercased] + * Description: Returns an array with all string keys lowercased [or uppercased] * Source code: ext/standard/array.c */ diff --git a/ext/standard/tests/array/array_change_key_case_variation2.phpt b/ext/standard/tests/array/array_change_key_case_variation2.phpt index f2a9385234..6b2f4ef1ab 100644 --- a/ext/standard/tests/array/array_change_key_case_variation2.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation2.phpt @@ -5,7 +5,7 @@ Test array_change_key_case() function : usage variations - Pass different data t --FILE-- <?php /* Prototype : array array_change_key_case(array $input [, int $case]) - * Description: Retuns an array with all string keys lowercased [or uppercased] + * Description: Returns an array with all string keys lowercased [or uppercased] * Source code: ext/standard/array.c */ diff --git a/ext/standard/tests/array/array_change_key_case_variation3.phpt b/ext/standard/tests/array/array_change_key_case_variation3.phpt index 596703385c..f395f8ed6b 100644 --- a/ext/standard/tests/array/array_change_key_case_variation3.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation3.phpt @@ -3,7 +3,7 @@ Test array_change_key_case() function : usage variations - different data types --FILE-- <?php /* Prototype : array array_change_key_case(array $input [, int $case]) - * Description: Retuns an array with all string keys lowercased [or uppercased] + * Description: Returns an array with all string keys lowercased [or uppercased] * Source code: ext/standard/array.c */ diff --git a/ext/standard/tests/array/array_change_key_case_variation4.phpt b/ext/standard/tests/array/array_change_key_case_variation4.phpt index ad9ad75a38..89b6ee0797 100644 --- a/ext/standard/tests/array/array_change_key_case_variation4.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation4.phpt @@ -3,7 +3,7 @@ Test array_change_key_case() function : usage variations - different int values --FILE-- <?php /* Prototype : array array_change_key_case(array $input [, int $case]) - * Description: Retuns an array with all string keys lowercased [or uppercased] + * Description: Returns an array with all string keys lowercased [or uppercased] * Source code: ext/standard/array.c */ diff --git a/ext/standard/tests/array/array_change_key_case_variation5.phpt b/ext/standard/tests/array/array_change_key_case_variation5.phpt index aa3852a41f..185534f9be 100644 --- a/ext/standard/tests/array/array_change_key_case_variation5.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation5.phpt @@ -3,7 +3,7 @@ Test array_change_key_case() function : usage variations - position of internal --FILE-- <?php /* Prototype : array array_change_key_case(array $input [, int $case]) - * Description: Retuns an array with all string keys lowercased [or uppercased] + * Description: Returns an array with all string keys lowercased [or uppercased] * Source code: ext/standard/array.c */ diff --git a/ext/standard/tests/array/array_change_key_case_variation6.phpt b/ext/standard/tests/array/array_change_key_case_variation6.phpt index d4371d3459..3cafb4d0ad 100644 --- a/ext/standard/tests/array/array_change_key_case_variation6.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation6.phpt @@ -3,7 +3,7 @@ Test array_change_key_case() function : usage variations - multidimensional arra --FILE-- <?php /* Prototype : array array_change_key_case(array $input [, int $case]) - * Description: Retuns an array with all string keys lowercased [or uppercased] + * Description: Returns an array with all string keys lowercased [or uppercased] * Source code: ext/standard/array.c */ diff --git a/ext/standard/tests/array/array_change_key_case_variation7.phpt b/ext/standard/tests/array/array_change_key_case_variation7.phpt index 8cbc23a12f..a08a1afa8c 100644 --- a/ext/standard/tests/array/array_change_key_case_variation7.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation7.phpt @@ -3,7 +3,7 @@ Test array_change_key_case() function : usage variations - referenced variables --FILE-- <?php /* Prototype : array array_change_key_case(array $input [, int $case]) - * Description: Retuns an array with all string keys lowercased [or uppercased] + * Description: Returns an array with all string keys lowercased [or uppercased] * Source code: ext/standard/array.c */ diff --git a/ext/standard/tests/array/compact_variation1.phpt b/ext/standard/tests/array/compact_variation1.phpt index ea48132857..d2b9fc45df 100644 --- a/ext/standard/tests/array/compact_variation1.phpt +++ b/ext/standard/tests/array/compact_variation1.phpt @@ -37,10 +37,6 @@ array(1) { Warning: compact(): recursion detected in %s on line %d Warning: compact(): recursion detected in %s on line %d - -Warning: compact(): recursion detected in %s on line %d - -Warning: compact(): recursion detected in %s on line %d array(2) { ["a"]=> int(1) diff --git a/ext/standard/tests/array/count_variation3.phpt b/ext/standard/tests/array/count_variation3.phpt index e11b4c2449..9c89bcd16b 100644 --- a/ext/standard/tests/array/count_variation3.phpt +++ b/ext/standard/tests/array/count_variation3.phpt @@ -35,5 +35,5 @@ int(4) -- $mode = 1: -- Warning: count(): recursion detected in %s on line %d -int(12) +int(4) Done diff --git a/ext/standard/tests/file/file.inc b/ext/standard/tests/file/file.inc index aff9d107d9..1a98d16dfb 100644 --- a/ext/standard/tests/file/file.inc +++ b/ext/standard/tests/file/file.inc @@ -528,7 +528,7 @@ function delete_links($file_path, corresponding next 13 values of the same stat for equality $stat = stat array - Retuns: true when all of them match, false otherwise + Returns: true when all of them match, false otherwise */ function compare_self_stat( array $stat ) { diff --git a/ext/standard/tests/file/fopen_unlink.phpt b/ext/standard/tests/file/fopen_unlink.phpt new file mode 100644 index 0000000000..c069ea1b94 --- /dev/null +++ b/ext/standard/tests/file/fopen_unlink.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test fopen() function : check fopen()ed descriptor is usable after the fs object is removed +--FILE-- +<?php + +var_dump( + $p = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tututu', + $f = fopen($p, 'w+'), + unlink($p), + file_exists($p), + fwrite($f, 'hello'), + fseek($f, 0), + fread($f, 16), + fwrite($f, 'world'), + fseek($f, 0), + fread($f, 16), + fclose($f) +); + +?> +===DONE=== +--EXPECTF-- +string(%d) "%stututu" +resource(%s) of type (Unknown) +bool(true) +bool(false) +int(5) +int(0) +string(5) "hello" +int(5) +int(0) +string(10) "helloworld" +bool(true) +===DONE=== diff --git a/ext/standard/tests/file/realpath_cache_win32.phpt b/ext/standard/tests/file/realpath_cache_win32.phpt index e74a6565a7..fa5f22c3b5 100644 --- a/ext/standard/tests/file/realpath_cache_win32.phpt +++ b/ext/standard/tests/file/realpath_cache_win32.phpt @@ -11,7 +11,7 @@ if (substr(PHP_OS, 0, 3) != 'WIN') { var_dump(realpath_cache_size()); $data = realpath_cache_get(); -var_dump($data[__DIR__]); +var_dump($data[__FILE__]); echo "Done\n"; ?> @@ -21,9 +21,9 @@ array(8) { ["key"]=> %s(%d%s) ["is_dir"]=> - bool(true) + bool(false) ["realpath"]=> - string(%d) "%sfile" + string(%d) "%sphp" ["expires"]=> int(%d) ["is_rvalid"]=> diff --git a/ext/standard/tests/file/touch_variation5-win32.phpt b/ext/standard/tests/file/touch_variation5-win32.phpt index 92bd8b7b5b..92b67c24a6 100644 --- a/ext/standard/tests/file/touch_variation5-win32.phpt +++ b/ext/standard/tests/file/touch_variation5-win32.phpt @@ -178,10 +178,10 @@ PASSED: %s/touchVar5.tmp/../touchVar5.tmp/aSubDirOrFile - created Warning: touch(): Unable to create file %s/BADDIR/aSubDirOrFile because %s in %s on line %d --- testing touchVar5.tmp/aSubDirOrFile/ --- -Warning: touch(): Unable to create file touchVar5.tmp/aSubDirOrFile/ because Invalid argument in %s on line %d +Warning: touch(): Unable to create file touchVar5.tmp/aSubDirOrFile/ because %s in %s on line %d --- testing %s/touchVar5.tmp/aSubDirOrFile/ --- -Warning: touch(): Unable to create file %s/touchVar5.tmp/aSubDirOrFile/ because Invalid argument in %s on line %d +Warning: touch(): Unable to create file %s/touchVar5.tmp/aSubDirOrFile/ because %s in %s on line %d --- testing touchVar5.tmp//aSubDirOrFile --- PASSED: touchVar5.tmp//aSubDirOrFile - created --- testing %s//touchVar5.tmp//aSubDirOrFile --- diff --git a/ext/standard/tests/file/touch_variation6-win32.phpt b/ext/standard/tests/file/touch_variation6-win32.phpt index 625e571950..177de94e48 100644 --- a/ext/standard/tests/file/touch_variation6-win32.phpt +++ b/ext/standard/tests/file/touch_variation6-win32.phpt @@ -184,10 +184,10 @@ PASSED: %s\touchVar5.tmp\..\touchVar5.tmp\aSubDirOrFile - created Warning: touch(): Unable to create file %s\BADDIR\aSubDirOrFile because %s in %s on line %d --- testing touchVar5.tmp\aSubDirOrFile\ --- -Warning: touch(): Unable to create file touchVar5.tmp\aSubDirOrFile\ because Invalid argument in %s on line %d +Warning: touch(): Unable to create file touchVar5.tmp\aSubDirOrFile\ because %s in %s on line %d --- testing %s\touchVar5.tmp\aSubDirOrFile\ --- -Warning: touch(): Unable to create file %s\touchVar5.tmp\aSubDirOrFile\ because Invalid argument in %s on line %d +Warning: touch(): Unable to create file %s\touchVar5.tmp\aSubDirOrFile\ because %s in %s on line %d --- testing touchVar5.tmp\\aSubDirOrFile --- PASSED: touchVar5.tmp\\aSubDirOrFile - created --- testing %s\\touchVar5.tmp\\aSubDirOrFile --- diff --git a/ext/standard/tests/file/unlink_error-win32-mb.phpt b/ext/standard/tests/file/unlink_error-win32-mb.phpt index 5111f34b76..4ce4ca796a 100644 --- a/ext/standard/tests/file/unlink_error-win32-mb.phpt +++ b/ext/standard/tests/file/unlink_error-win32-mb.phpt @@ -108,6 +108,6 @@ bool(false) -- Testing unlink() on directory -- -Warning: unlink(%s/unlink_error): Permission denied in %s on line %d +Warning: unlink(%s/unlink_error): Is a directory in %s on line %d bool(false) Done diff --git a/ext/standard/tests/file/unlink_error-win32.phpt b/ext/standard/tests/file/unlink_error-win32.phpt index e55f6ed5cd..f7a123919f 100644 --- a/ext/standard/tests/file/unlink_error-win32.phpt +++ b/ext/standard/tests/file/unlink_error-win32.phpt @@ -105,6 +105,6 @@ bool(false) -- Testing unlink() on directory -- -Warning: unlink(%s/unlink_error): Permission denied in %s on line %d +Warning: unlink(%s/unlink_error): Is a directory in %s on line %d bool(false) Done diff --git a/ext/standard/tests/file/unlink_variation2-win32.phpt b/ext/standard/tests/file/unlink_variation2-win32.phpt deleted file mode 100644 index af7b381547..0000000000 --- a/ext/standard/tests/file/unlink_variation2-win32.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -Test unlink() function : usage variations - unlink file in use ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) != 'WIN') { - die('skip only on Windows'); -} -?> ---FILE-- -<?php -/* Prototype : bool unlink ( string $filename [, resource $context] ); - Description : Deletes filename -*/ - -/* Try to unlink file when file handle is still in use */ - -$file_path = dirname(__FILE__); - -echo "*** Testing unlink() on a file when file handle is open ***\n"; -// temp file name used here -$filename = "$file_path/unlink_variation2-win32.tmp"; - -// create file -$fp = fopen($filename, "w"); -// try unlink() on $filename -var_dump( unlink($filename) ); // expected: false as file handle is still open -// now close file handle -fclose($fp); - -// now unlink file -var_dump( unlink($filename) ); // expected: true -var_dump( file_exists($filename) ); // confirm file is deleted - -echo "Done\n"; -?> ---EXPECTF-- -*** Testing unlink() on a file when file handle is open *** - -Warning: unlink(%s): %s in %s on line %d -bool(false) -bool(true) -bool(false) -Done diff --git a/ext/standard/tests/file/unlink_variation2.phpt b/ext/standard/tests/file/unlink_variation2.phpt index 071a65780c..0068dbfe17 100644 --- a/ext/standard/tests/file/unlink_variation2.phpt +++ b/ext/standard/tests/file/unlink_variation2.phpt @@ -1,11 +1,5 @@ --TEST-- Test unlink() function : usage variations - unlink file in use ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip only on Linux'); -} -?> --FILE-- <?php /* Prototype : bool unlink ( string $filename [, resource $context] ); 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 c06dff556d..e2c84dae9b 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt @@ -135,25 +135,7 @@ object(object_class)#%d (6) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 2 -- object(no_member_class)#%d (0) refcount(%d){ @@ -184,25 +166,7 @@ object(contains_object_class)#%d (9) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } + *RECURSION* } ["class_object2"]=> object(object_class)#%d (6) refcount(%d){ @@ -222,25 +186,7 @@ object(contains_object_class)#%d (9) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } + *RECURSION* } ["class_object3":"contains_object_class":private]=> object(object_class)#%d (6) refcount(%d){ @@ -260,25 +206,7 @@ object(contains_object_class)#%d (9) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } + *RECURSION* } ["class_object4":protected]=> object(object_class)#%d (6) refcount(%d){ @@ -298,195 +226,13 @@ object(contains_object_class)#%d (9) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } + *RECURSION* } ["no_member_class_object"]=> object(no_member_class)#%d (0) refcount(%d){ } ["class_object5"]=> - object(contains_object_class)#%d (9) refcount(%d){ - ["p"]=> - int(30) - ["p1":protected]=> - int(40) - ["p2":"contains_object_class":private]=> - int(50) - ["class_object1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } - } - ["class_object2"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } - } - ["class_object3":"contains_object_class":private]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } - } - ["class_object4":protected]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } - } - ["no_member_class_object"]=> - object(no_member_class)#%d (0) refcount(%d){ - } - ["class_object5"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 4 -- object(object_class)#%d (6) refcount(%d){ @@ -506,25 +252,7 @@ object(object_class)#%d (6) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 5 -- object(object_class)#%d (6) refcount(%d){ @@ -544,25 +272,7 @@ object(object_class)#%d (6) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 6 -- object(no_member_class)#%d (0) refcount(%d){ @@ -587,25 +297,7 @@ object(object_class)#%d (6) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 9 -- object(object_class)#%d (6) refcount(%d){ @@ -625,25 +317,7 @@ object(object_class)#%d (6) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (6) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - } + *RECURSION* } -- Iteration 10 -- int(30) @@ -674,67 +348,7 @@ object(object_class)#%d (7) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (7) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - ["obj"]=> - &object(object_class)#%d (7) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - object(object_class)#%d (7) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - ["obj"]=> - *RECURSION* - } - ["obj"]=> - *RECURSION* - } - } + *RECURSION* ["obj"]=> &object(object_class)#%d (7) refcount(%d){ ["value1"]=> @@ -753,89 +367,9 @@ object(object_class)#%d (7) refcount(%d){ int(3) } ["object_class1"]=> - object(object_class)#%d (7) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - ["obj"]=> - &object(object_class)#%d (7) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - ["obj"]=> - *RECURSION* - } - } + *RECURSION* ["obj"]=> - &object(object_class)#%d (7) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - ["obj"]=> - &object(object_class)#%d (7) refcount(%d){ - ["value1"]=> - int(5) - ["value2":"object_class":private]=> - int(10) - ["value3":protected]=> - int(20) - ["value4"]=> - int(30) - ["array_var"]=> - array(2) refcount(%d){ - ["key1"]=> - int(1) - ["key2 "]=> - int(3) - } - ["object_class1"]=> - *RECURSION* - ["obj"]=> - *RECURSION* - } - } + *RECURSION* } } Done diff --git a/ext/standard/tests/general_functions/ini_get_all.phpt b/ext/standard/tests/general_functions/ini_get_all.phpt index 806831edfc..005bbb5b4e 100644 --- a/ext/standard/tests/general_functions/ini_get_all.phpt +++ b/ext/standard/tests/general_functions/ini_get_all.phpt @@ -5,6 +5,7 @@ pcre.backtrack_limit=1000000 pcre.recursion_limit=100000 --SKIPIF-- <?php if (!extension_loaded("reflection")) die("skip"); ?> +<?php if (!PCRE_JIT_SUPPORT) die("skip no pcre jit support"); ?> --FILE-- <?php diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt index 4b0c2060ce..aeb7ee4bd1 100644 --- a/ext/standard/tests/general_functions/phpinfo.phpt +++ b/ext/standard/tests/general_functions/phpinfo.phpt @@ -33,7 +33,7 @@ Zend Extension => %d Zend Extension Build => API%s PHP Extension Build => API%s Debug Build => %s -Thread Safety => %s +Thread Safety => %s%A Zend Signal Handling => %s Zend Memory Manager => %s Zend Multibyte Support => %s diff --git a/ext/standard/tests/general_functions/sleep_basic.phpt b/ext/standard/tests/general_functions/sleep_basic.phpt index 5d7fe536f1..ac0b1d7db2 100644 --- a/ext/standard/tests/general_functions/sleep_basic.phpt +++ b/ext/standard/tests/general_functions/sleep_basic.phpt @@ -13,7 +13,7 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); echo "*** Testing sleep() : basic functionality ***\n"; -$sleeptime = 5; // sleep for 5 seconds +$sleeptime = 1; // sleep for 1 seconds set_time_limit(20); diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt index 2e1e81c2ee..6d76431dbc 100644 --- a/ext/standard/tests/general_functions/strval.phpt +++ b/ext/standard/tests/general_functions/strval.phpt @@ -96,7 +96,7 @@ $scalars = array( $heredoc_empty_string ); /* loop to check that strval() recognizes different - scalar values and retuns the string conversion of same */ + scalar values and returns the string conversion of same */ $loop_counter = 1; foreach ($scalars as $scalar ) { echo "-- Iteration $loop_counter --\n"; $loop_counter++; diff --git a/ext/standard/tests/general_functions/usleep_basic.phpt b/ext/standard/tests/general_functions/usleep_basic.phpt index d6f312e15b..bec1dfa1d7 100644 --- a/ext/standard/tests/general_functions/usleep_basic.phpt +++ b/ext/standard/tests/general_functions/usleep_basic.phpt @@ -15,7 +15,7 @@ set_time_limit(20); echo "*** Testing usleep() : basic functionality ***\n"; -$sleeptime = 5000000; // == 5 seconds +$sleeptime = 1000000; // == 1 seconds // Test passes if sleeps for at least 98% of specified time $sleeplow = $sleeptime - ($sleeptime * 2 /100); diff --git a/ext/standard/tests/image/getimagesize.phpt b/ext/standard/tests/image/getimagesize.phpt index eefa331ea5..1164f10c3e 100644 --- a/ext/standard/tests/image/getimagesize.phpt +++ b/ext/standard/tests/image/getimagesize.phpt @@ -37,7 +37,7 @@ array(16) { ["bits"]=> int(24) ["mime"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" } ["test12pix.webp"]=> array(6) { @@ -67,7 +67,7 @@ array(16) { ["bits"]=> int(32) ["mime"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" } ["test1pix.bmp"]=> array(6) { @@ -82,7 +82,7 @@ array(16) { ["bits"]=> int(24) ["mime"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" } ["test1pix.jp2"]=> array(7) { diff --git a/ext/standard/tests/image/getimagesize_basic.phpt b/ext/standard/tests/image/getimagesize_basic.phpt index 4d47225818..63ae334066 100644 --- a/ext/standard/tests/image/getimagesize_basic.phpt +++ b/ext/standard/tests/image/getimagesize_basic.phpt @@ -138,7 +138,7 @@ array(6) { ["bits"]=> int(24) ["mime"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" } array(0) { } diff --git a/ext/standard/tests/image/image_type_to_mime_type.phpt b/ext/standard/tests/image/image_type_to_mime_type.phpt index 4ae5680238..38a90c1bb3 100644 --- a/ext/standard/tests/image/image_type_to_mime_type.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type.phpt @@ -27,13 +27,13 @@ image_type_to_mime_type() --EXPECT-- array(16) { ["test-1pix.bmp"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" ["test12pix.webp"]=> string(10) "image/webp" ["test1bpix.bmp"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" ["test1pix.bmp"]=> - string(14) "image/x-ms-bmp" + string(9) "image/bmp" ["test1pix.jp2"]=> string(9) "image/jp2" ["test1pix.jpc"]=> diff --git a/ext/standard/tests/image/image_type_to_mime_type_basic.phpt b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt index 5506570494..9ee91961c2 100644 --- a/ext/standard/tests/image/image_type_to_mime_type_basic.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt @@ -49,7 +49,7 @@ string(10) "image/jpeg" string(9) "image/png" string(29) "application/x-shockwave-flash" string(9) "image/psd" -string(14) "image/x-ms-bmp" +string(9) "image/bmp" string(10) "image/tiff" string(10) "image/tiff" string(24) "application/octet-stream" diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt index 7b06c0a145..1b4f418cdb 100644 --- a/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt +++ b/ext/standard/tests/image/image_type_to_mime_type_variation3.phpt @@ -39,7 +39,7 @@ string\(29\) "application\/x-shockwave-flash" string\(9\) "image\/psd" -- Iteration 6 -- -string\(14\) "image\/x-ms-bmp" +string\(9\) "image\/bmp" -- Iteration 7 -- string\(10\) "image\/tiff" diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt index 6d624d84ab..8fc95190c6 100644 --- a/ext/standard/tests/math/lcg_value_basic.phpt +++ b/ext/standard/tests/math/lcg_value_basic.phpt @@ -21,36 +21,38 @@ if ($i != 100) { echo "PASSED\n"; } -echo "\n lcg_value error cases..spurious args get ignored\n"; +echo "\n lcg_value error cases..\n"; $res = lcg_value(23); -if (!is_float($res) || $res < 0 || $res > 1) { - echo "FAILED\n"; -} else { +if (is_null($res)) { echo "PASSED\n"; +} else { + echo "FAILED\n"; } $res = lcg_value(10,false); -if (!is_float($res) || $res < 0 || $res > 1) { - echo "FAILED\n"; -} else { +if (is_null($res)) { echo "PASSED\n"; +} else { + echo "FAILED\n"; } echo "MATHS test script completed\n"; ?> ---EXPECT-- +--EXPECTF-- MATHS test script started lcg_value tests... PASSED - lcg_value error cases..spurious args get ignored + lcg_value error cases.. + +Warning: lcg_value() expects exactly 0 parameters, 1 given in %slcg_value_basic.php on line %d PASSED + +Warning: lcg_value() expects exactly 0 parameters, 2 given in %slcg_value_basic.php on line %d PASSED MATHS test script completed - - diff --git a/ext/standard/tests/math/rand_inverted_order.phpt b/ext/standard/tests/math/rand_inverted_order.phpt new file mode 100644 index 0000000000..ac904b21ed --- /dev/null +++ b/ext/standard/tests/math/rand_inverted_order.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test rand funtion when min and max are in proper or inverted order +--CREDIT-- +PHP TestFEst 2017 - PHPDublin, PHPSP - Joao P V Martins <jp.joao@gmail.com> +--FILE-- +<?php +$min_value = 10; +$max_value = 20; +$correct_order = rand($min_value, $max_value); +$incorrect_order = rand($max_value, $min_value); +var_dump($correct_order >= $min_value); +var_dump($correct_order <= $max_value); +var_dump($incorrect_order >= $min_value); +var_dump($incorrect_order <= $max_value); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/ext/standard/tests/network/net_get_interfaces_001.phpt b/ext/standard/tests/network/net_get_interfaces_001.phpt new file mode 100644 index 0000000000..522278e90d --- /dev/null +++ b/ext/standard/tests/network/net_get_interfaces_001.phpt @@ -0,0 +1,30 @@ +--TEST-- +net_get_interfaces IPv4 Loopback +--SKIPIF-- +<?php +function_exists('net_get_interfaces') || print 'skip'; +--FILE-- +<?php + +// Test that we have exactly one unicast address with the address 127.0.0.1 +// On linux this will often be named "lo", but even that isn't guaranteed. + +$ifaces = net_get_interfaces(); + +$found = false; +foreach ($ifaces as $iface) { + foreach ($iface['unicast'] as $unicast) { + if (($unicast['address'] ?? null) === '127.0.0.1') { + $found = true; + break 2; + } + } +} + +var_dump($found); +if (!$found) { + // Extra diagnostics! + var_dump($ifaces); +} +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/serialize/bug70172.phpt b/ext/standard/tests/serialize/bug70172.phpt index 471d1a4b4e..a2359d6434 100644 --- a/ext/standard/tests/serialize/bug70172.phpt +++ b/ext/standard/tests/serialize/bug70172.phpt @@ -19,7 +19,7 @@ $fakezval .= "\x01"; $fakezval .= "\x00"; $fakezval .= "\x00\x00"; -$inner = 'r:2;'; +$inner = 'R:2;'; $exploit = 'a:2:{i:0;i:1;i:1;C:3:"obj":'.strlen($inner).':{'.$inner.'}}'; $data = unserialize($exploit); diff --git a/ext/standard/tests/serialize/bug70963.phpt b/ext/standard/tests/serialize/bug70963.phpt index 0bdfb2c4c9..c4e2267b04 100644 --- a/ext/standard/tests/serialize/bug70963.phpt +++ b/ext/standard/tests/serialize/bug70963.phpt @@ -25,22 +25,6 @@ array(2) { [1]=> string(4) "test" } -array(2) { - [0]=> - object(Exception)#%d (6) { - ["message":protected]=> - string(0) "" - ["string":"Exception":private]=> - string(0) "" - ["code":protected]=> - int(0) - ["file":protected]=> - string(%d) "%s" - ["line":protected]=> - int(3) - ["previous":"Exception":private]=> - NULL - } - [1]=> - string(4) "test" -} + +Notice: unserialize(): Error at offset %d of %d bytes in %sbug70963.php on line 3 +bool(false) diff --git a/ext/standard/tests/serialize/unserialize_mem_leak.phpt b/ext/standard/tests/serialize/unserialize_mem_leak.phpt index 97c59f9ad1..2a295d83b9 100644 --- a/ext/standard/tests/serialize/unserialize_mem_leak.phpt +++ b/ext/standard/tests/serialize/unserialize_mem_leak.phpt @@ -8,9 +8,12 @@ function foo() { gc_collect_cycles(); } +$str = 'a:1:{i:0;R:1;}'; +foo(unserialize($str)); $str = 'a:1:{i:0;r:1;}'; foo(unserialize($str)); echo "okey"; ?> ---EXPECT-- +--EXPECTF-- +Notice: unserialize(): Error at offset %d of %d bytes in %sunserialize_mem_leak.php on line 9 okey diff --git a/ext/standard/tests/setrawcookie_basic_001.phpt b/ext/standard/tests/setrawcookie_basic_001.phpt new file mode 100644 index 0000000000..4a6fcc8d9b --- /dev/null +++ b/ext/standard/tests/setrawcookie_basic_001.phpt @@ -0,0 +1,10 @@ +--TEST-- +Test setrawcookie basic functionality +--CREDIT-- +PHP TestFEst 2017 - PHPDublin, PHPSP - Joao P V Martins <jp.joao@gmail.com> +--FILE-- +<?php +var_dump(setrawcookie('cookie_name', rawurlencode('cookie_content'))); +?> +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/setrawcookie_basic_002.phpt b/ext/standard/tests/setrawcookie_basic_002.phpt new file mode 100644 index 0000000000..fc98c8dcf4 --- /dev/null +++ b/ext/standard/tests/setrawcookie_basic_002.phpt @@ -0,0 +1,12 @@ +--TEST-- +Test setrawcookie to fail when output exists before +--CREDIT-- +PHP TestFEst 2017 - PHPDublin, PHPSP - Joao P V Martins <jp.joao@gmail.com> +--FILE-- +<?php +echo 'output' . PHP_EOL; +var_dump(@setrawcookie('cookie_name', rawurlencode('cookie_content'))); +?> +--EXPECT-- +output +bool(false) diff --git a/ext/standard/tests/streams/bug75031.phpt b/ext/standard/tests/streams/bug75031.phpt new file mode 100644 index 0000000000..f0d67a3524 --- /dev/null +++ b/ext/standard/tests/streams/bug75031.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #75031: Append mode in php://temp and php://memory +--FILE-- +<?php + +function test_75031($type, $mode) { + $fp = fopen($type, $mode); + fwrite($fp, "hello"); + fseek($fp, 0, SEEK_SET); + fwrite($fp, "world"); + var_dump(stream_get_contents($fp, -1, 0)); + fclose($fp); +} + +test_75031("php://temp", "w+"); +test_75031("php://memory", "w+"); +test_75031("php://temp", "a+"); +test_75031("php://memory", "a+"); + +?> +--EXPECT-- +string(5) "world" +string(5) "world" +string(10) "helloworld" +string(10) "helloworld" diff --git a/ext/standard/tests/strings/bug72433.phpt b/ext/standard/tests/strings/bug72433.phpt index d5a6612f2b..534b1e6ac6 100644 --- a/ext/standard/tests/strings/bug72433.phpt +++ b/ext/standard/tests/strings/bug72433.phpt @@ -19,41 +19,5 @@ $fill_freed_space_2 = "filler_zval_2"; var_dump($free_me); ?> --EXPECTF-- -array(3) { - [0]=> - array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - object(ArrayObject)#%d (1) { - ["storage":"ArrayObject":private]=> - *RECURSION* - } - } - [1]=> - array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - object(ArrayObject)#%d (1) { - ["storage":"ArrayObject":private]=> - *RECURSION* - } - } - [2]=> - object(ArrayObject)#%d (1) { - ["storage":"ArrayObject":private]=> - array(3) { - [0]=> - *RECURSION* - [1]=> - *RECURSION* - [2]=> - *RECURSION* - } - } -} +Notice: unserialize(): Error at offset %d of %d bytes in %sbug72433.php on line 8 +bool(false) diff --git a/ext/standard/tests/strings/strnatcmp_leftalign.phpt b/ext/standard/tests/strings/strnatcmp_leftalign.phpt new file mode 100644 index 0000000000..31eed642ac --- /dev/null +++ b/ext/standard/tests/strings/strnatcmp_leftalign.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test strnatcmp() function : left align, whitespace, digits +--CREDIT-- +Sol Richardson <sr5732358@hotmail.com> +--FILE-- +<?php +/* Prototype : int strnatcmp ( string $str1 , string $str2 ) +* Description: String comparisons using a "natural order" algorithm +* Source code: ext/standard/string.c +*/ + +echo "-- Testing strnatcmp() function whitespace, left-align, digit --\n"; +echo "-- Leading whitespace, digits, string 1 longer --\n"; +$str1 = " 00"; +$str2 = " 0"; +var_dump( strnatcmp( $str1, $str2) ); + +echo "-- Leading whitespace, digits, string 2 longer --\n"; +$str1 = " 0"; +$str2 = " 00"; +var_dump( strnatcmp( $str1, $str2) ); +?> + +--EXPECTF-- +-- Testing strnatcmp() function whitespace, left-align, digit -- +-- Leading whitespace, digits, string 1 longer -- +int(1) +-- Leading whitespace, digits, string 2 longer -- +int(-1) |