diff options
| author | Ondřej Surý <ondrej@sury.org> | 2012-01-11 15:43:42 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2012-01-11 15:43:42 +0100 |
| commit | 8f1428d29ef91d74b4d272af171675f2971eb15b (patch) | |
| tree | a1f4f4d7dc5bfe8096806dd5c5266634e19fa07a /ext/standard/tests | |
| parent | c6e4182351e0173fe58de141e143aac2eacf5efe (diff) | |
| download | php-8f1428d29ef91d74b4d272af171675f2971eb15b.tar.gz | |
Imported Upstream version 5.3.9upstream/5.3.9
Diffstat (limited to 'ext/standard/tests')
81 files changed, 1558 insertions, 384 deletions
diff --git a/ext/standard/tests/array/array_change_key_case_variation8.phpt b/ext/standard/tests/array/array_change_key_case_variation8.phpt index f9893da79..3dc22ce0e 100644 --- a/ext/standard/tests/array/array_change_key_case_variation8.phpt +++ b/ext/standard/tests/array/array_change_key_case_variation8.phpt @@ -1,5 +1,10 @@ --TEST-- Test array_change_key_case() function : usage variations - Different strings as keys +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)"); +} --FILE-- <?php /* Prototype : array array_change_key_case(array $input [, int $case]) diff --git a/ext/standard/tests/array/arsort_variation5.phpt b/ext/standard/tests/array/arsort_variation5.phpt index e69c26988..55c0882db 100644 --- a/ext/standard/tests/array/arsort_variation5.phpt +++ b/ext/standard/tests/array/arsort_variation5.phpt @@ -1,5 +1,10 @@ --TEST-- -Test arsort() function : usage variations - sort strings +Test arsort() function : usage variations - sort strings +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)"); +} --FILE-- <?php /* Prototype : bool arsort ( array &$array [, int $asort_flags] ) @@ -76,8 +81,10 @@ array(12) { string(3) "\cx" ["\a"]=> string(2) "\a" - ["
"]=> - string(1) "
" + [" +"]=> + string(1) " +" [""]=> string(1) "" [""]=> @@ -106,8 +113,10 @@ array(12) { string(3) "\cx" ["\a"]=> string(2) "\a" - ["
"]=> - string(1) "
" + [" +"]=> + string(1) " +" [""]=> string(1) "" [""]=> @@ -136,8 +145,10 @@ array(12) { string(3) "\cx" ["\a"]=> string(2) "\a" - ["
"]=> - string(1) "
" + [" +"]=> + string(1) " +" [""]=> string(1) "" [""]=> diff --git a/ext/standard/tests/array/asort_variation5.phpt b/ext/standard/tests/array/asort_variation5.phpt index faf7a5de5..bb27dd692 100644 --- a/ext/standard/tests/array/asort_variation5.phpt +++ b/ext/standard/tests/array/asort_variation5.phpt @@ -1,5 +1,10 @@ --TEST-- -Test asort() function : usage variations - sort strings +Test asort() function : usage variations - sort strings +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)"); +} --FILE-- <?php /* Prototype : bool asort ( array &$array [, int $asort_flags] ) diff --git a/ext/standard/tests/array/krsort_variation5.phpt b/ext/standard/tests/array/krsort_variation5.phpt index 59621654c..0dffc1956 100644 --- a/ext/standard/tests/array/krsort_variation5.phpt +++ b/ext/standard/tests/array/krsort_variation5.phpt @@ -1,5 +1,10 @@ --TEST-- -Test krsort() function : usage variations - sort strings +Test krsort() function : usage variations - sort strings +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)"); +} --FILE-- <?php /* Prototype : bool krsort ( array &$array [, int $sort_flags] ) @@ -76,8 +81,10 @@ array(11) { string(3) "\cx" ["\a"]=> string(2) "\a" - ["
"]=> - string(1) "
" + [" +"]=> + string(1) " +" [""]=> string(1) "" [""]=> @@ -104,8 +111,10 @@ array(11) { string(3) "\cx" ["\a"]=> string(2) "\a" - ["
"]=> - string(1) "
" + [" +"]=> + string(1) " +" [""]=> string(1) "" [""]=> @@ -132,8 +141,10 @@ array(11) { string(3) "\cx" ["\a"]=> string(2) "\a" - ["
"]=> - string(1) "
" + [" +"]=> + string(1) " +" [""]=> string(1) "" [""]=> diff --git a/ext/standard/tests/array/ksort_variation5.phpt b/ext/standard/tests/array/ksort_variation5.phpt index 958476c01..d83591aae 100644 --- a/ext/standard/tests/array/ksort_variation5.phpt +++ b/ext/standard/tests/array/ksort_variation5.phpt @@ -1,5 +1,10 @@ --TEST-- -Test ksort() function : usage variations - sort strings +Test ksort() function : usage variations - sort strings +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)"); +} --FILE-- <?php /* Prototype : bool ksort ( array &$array [, int $sort_flags] ) @@ -78,8 +83,10 @@ array(11) { string(1) "" [""]=> string(1) "" - ["
"]=> - string(1) "
" + [" +"]=> + string(1) " +" ["\a"]=> string(2) "\a" ["\cx"]=> @@ -106,8 +113,10 @@ array(11) { string(1) "" [""]=> string(1) "" - ["
"]=> - string(1) "
" + [" +"]=> + string(1) " +" ["\a"]=> string(2) "\a" ["\cx"]=> @@ -134,8 +143,10 @@ array(11) { string(1) "" [""]=> string(1) "" - ["
"]=> - string(1) "
" + [" +"]=> + string(1) " +" ["\a"]=> string(2) "\a" ["\cx"]=> diff --git a/ext/standard/tests/array/natcasesort_variation4.phpt b/ext/standard/tests/array/natcasesort_variation4.phpt index 81276ef1c..2a189f337 100644 --- a/ext/standard/tests/array/natcasesort_variation4.phpt +++ b/ext/standard/tests/array/natcasesort_variation4.phpt @@ -1,5 +1,10 @@ --TEST-- Test natcasesort() function : usage variations - different string types +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)"); +} --FILE-- <?php /* Prototype : bool natcasesort(array &$array_arg) diff --git a/ext/standard/tests/array/rsort_variation5.phpt b/ext/standard/tests/array/rsort_variation5.phpt index eba6bc420..e955cb34f 100644 --- a/ext/standard/tests/array/rsort_variation5.phpt +++ b/ext/standard/tests/array/rsort_variation5.phpt @@ -1,5 +1,10 @@ --TEST-- Test rsort() function : usage variations - String values +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)"); +} --FILE-- <?php /* Prototype : bool rsort(array &$array_arg [, int $sort_flags]) diff --git a/ext/standard/tests/array/sort_variation5.phpt b/ext/standard/tests/array/sort_variation5.phpt index 061a1cbac..7384c7402 100644 --- a/ext/standard/tests/array/sort_variation5.phpt +++ b/ext/standard/tests/array/sort_variation5.phpt @@ -1,5 +1,10 @@ --TEST-- -Test sort() function : usage variations - sort strings +Test sort() function : usage variations - sort strings +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)"); +} --FILE-- <?php /* Prototype : bool sort ( array &$array [, int $sort_flags] ) @@ -74,7 +79,8 @@ array(12) { [5]=> string(1) "" [6]=> - string(1) "
" + string(1) " +" [7]=> string(2) "\a" [8]=> @@ -103,7 +109,8 @@ array(12) { [5]=> string(1) "" [6]=> - string(1) "
" + string(1) " +" [7]=> string(2) "\a" [8]=> @@ -132,7 +139,8 @@ array(12) { [5]=> string(1) "" [6]=> - string(1) "
" + string(1) " +" [7]=> string(2) "\a" [8]=> diff --git a/ext/standard/tests/class_object/is_a.phpt b/ext/standard/tests/class_object/is_a.phpt new file mode 100644 index 000000000..832d5550f --- /dev/null +++ b/ext/standard/tests/class_object/is_a.phpt @@ -0,0 +1,378 @@ +--TEST-- +is_a and is_subclass_of behaviour (with and without autoload) +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +interface if_a { + function f_a(); +} + +interface if_b extends if_a { + function f_b(); +} + +class base { + function _is_a($sub) { + + echo "\n>>> With Defined class\n"; + echo str_pad('is_a( OBJECT:'.get_class($this).', '.$sub.') = ', 60) . (is_a($this, $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_a(get_class($this), $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_a( STRING:'.get_class($this).', '.$sub.', true) = ', 60). (is_a(get_class($this), $sub, true) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( OBJECT:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of($this, $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.') = ', 60). (is_subclass_of(get_class($this), $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:'.get_class($this).', '.$sub.',false) = ', 60). (is_subclass_of(get_class($this), $sub , false) ? 'yes' : 'no')."\n"; + + // with autoload options.. + echo ">>> With Undefined\n"; + echo str_pad('is_a( STRING:undefB, '.$sub.',true) = ', 60). (is_a('undefB', $sub, true) ? 'yes' : 'no')."\n"; + echo str_pad('is_a( STRING:undefB, '.$sub.') = ', 60). (is_a('undefB', $sub) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:undefB, '.$sub.',false) = ', 60). (is_subclass_of('undefB', $sub, false) ? 'yes' : 'no')."\n"; + echo str_pad('is_subclass_of( STRING:undefB, '.$sub.') = ', 60). (is_subclass_of('undefB', $sub) ? 'yes' : 'no')."\n"; + } + function test() { + echo $this->_is_a('base'); + echo $this->_is_a('derived_a'); + echo $this->_is_a('if_a'); + echo $this->_is_a('undefA'); + echo "\n"; + } +} + +class derived_a extends base implements if_a { + function f_a() {} +} + +class derived_b extends base implements if_a, if_b { + function f_a() {} + function f_b() {} +} + +class derived_c extends derived_a implements if_b { + function f_b() {} +} + +class derived_d extends derived_c { +} + +$t = new base(); +$t->test(); + +$t = new derived_a(); +$t->test(); + +eval(' + function __autoload($name) + { + echo ">>>> In __autoload: "; + var_dump($name); + } +'); + +echo "NOW WITH AUTOLOAD\n\n"; + +$t = new base(); +$t->test(); + +$t = new derived_a(); +$t->test(); + +$t = new derived_b(); +$t->test(); + + + + + +?> +--EXPECTF-- +>>> With Defined class +is_a( OBJECT:base, base) = yes +is_a( STRING:base, base) = no +is_a( STRING:base, base, true) = yes +is_subclass_of( OBJECT:base, base) = no +is_subclass_of( STRING:base, base) = no +is_subclass_of( STRING:base, base,false) = no +>>> With Undefined +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:base, derived_a) = no +is_a( STRING:base, derived_a) = no +is_a( STRING:base, derived_a, true) = no +is_subclass_of( OBJECT:base, derived_a) = no +is_subclass_of( STRING:base, derived_a) = no +is_subclass_of( STRING:base, derived_a,false) = no +>>> With Undefined +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:base, if_a) = no +is_a( STRING:base, if_a) = no +is_a( STRING:base, if_a, true) = no +is_subclass_of( OBJECT:base, if_a) = no +is_subclass_of( STRING:base, if_a) = no +is_subclass_of( STRING:base, if_a,false) = no +>>> With Undefined +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:base, undefA) = no +is_a( STRING:base, undefA) = no +is_a( STRING:base, undefA, true) = no +is_subclass_of( OBJECT:base, undefA) = no +is_subclass_of( STRING:base, undefA) = no +is_subclass_of( STRING:base, undefA,false) = no +>>> With Undefined +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +is_subclass_of( STRING:undefB, undefA) = no + + +>>> With Defined class +is_a( OBJECT:derived_a, base) = yes +is_a( STRING:derived_a, base) = no +is_a( STRING:derived_a, base, true) = yes +is_subclass_of( OBJECT:derived_a, base) = yes +is_subclass_of( STRING:derived_a, base) = yes +is_subclass_of( STRING:derived_a, base,false) = no +>>> With Undefined +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:derived_a, derived_a) = yes +is_a( STRING:derived_a, derived_a) = no +is_a( STRING:derived_a, derived_a, true) = yes +is_subclass_of( OBJECT:derived_a, derived_a) = no +is_subclass_of( STRING:derived_a, derived_a) = no +is_subclass_of( STRING:derived_a, derived_a,false) = no +>>> With Undefined +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:derived_a, if_a) = yes +is_a( STRING:derived_a, if_a) = no +is_a( STRING:derived_a, if_a, true) = yes +is_subclass_of( OBJECT:derived_a, if_a) = yes +is_subclass_of( STRING:derived_a, if_a) = yes +is_subclass_of( STRING:derived_a, if_a,false) = no +>>> With Undefined +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:derived_a, undefA) = no +is_a( STRING:derived_a, undefA) = no +is_a( STRING:derived_a, undefA, true) = no +is_subclass_of( OBJECT:derived_a, undefA) = no +is_subclass_of( STRING:derived_a, undefA) = no +is_subclass_of( STRING:derived_a, undefA,false) = no +>>> With Undefined +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +is_subclass_of( STRING:undefB, undefA) = no + +NOW WITH AUTOLOAD + + +>>> With Defined class +is_a( OBJECT:base, base) = yes +is_a( STRING:base, base) = no +is_a( STRING:base, base, true) = yes +is_subclass_of( OBJECT:base, base) = no +is_subclass_of( STRING:base, base) = no +is_subclass_of( STRING:base, base,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:base, derived_a) = no +is_a( STRING:base, derived_a) = no +is_a( STRING:base, derived_a, true) = no +is_subclass_of( OBJECT:base, derived_a) = no +is_subclass_of( STRING:base, derived_a) = no +is_subclass_of( STRING:base, derived_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:base, if_a) = no +is_a( STRING:base, if_a) = no +is_a( STRING:base, if_a, true) = no +is_subclass_of( OBJECT:base, if_a) = no +is_subclass_of( STRING:base, if_a) = no +is_subclass_of( STRING:base, if_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:base, undefA) = no +is_a( STRING:base, undefA) = no +is_a( STRING:base, undefA, true) = no +is_subclass_of( OBJECT:base, undefA) = no +is_subclass_of( STRING:base, undefA) = no +is_subclass_of( STRING:base, undefA,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, undefA) = no + + +>>> With Defined class +is_a( OBJECT:derived_a, base) = yes +is_a( STRING:derived_a, base) = no +is_a( STRING:derived_a, base, true) = yes +is_subclass_of( OBJECT:derived_a, base) = yes +is_subclass_of( STRING:derived_a, base) = yes +is_subclass_of( STRING:derived_a, base,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:derived_a, derived_a) = yes +is_a( STRING:derived_a, derived_a) = no +is_a( STRING:derived_a, derived_a, true) = yes +is_subclass_of( OBJECT:derived_a, derived_a) = no +is_subclass_of( STRING:derived_a, derived_a) = no +is_subclass_of( STRING:derived_a, derived_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:derived_a, if_a) = yes +is_a( STRING:derived_a, if_a) = no +is_a( STRING:derived_a, if_a, true) = yes +is_subclass_of( OBJECT:derived_a, if_a) = yes +is_subclass_of( STRING:derived_a, if_a) = yes +is_subclass_of( STRING:derived_a, if_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:derived_a, undefA) = no +is_a( STRING:derived_a, undefA) = no +is_a( STRING:derived_a, undefA, true) = no +is_subclass_of( OBJECT:derived_a, undefA) = no +is_subclass_of( STRING:derived_a, undefA) = no +is_subclass_of( STRING:derived_a, undefA,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, undefA) = no + + +>>> With Defined class +is_a( OBJECT:derived_b, base) = yes +is_a( STRING:derived_b, base) = no +is_a( STRING:derived_b, base, true) = yes +is_subclass_of( OBJECT:derived_b, base) = yes +is_subclass_of( STRING:derived_b, base) = yes +is_subclass_of( STRING:derived_b, base,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, base,true) = no +is_a( STRING:undefB, base) = no +is_subclass_of( STRING:undefB, base,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, base) = no + +>>> With Defined class +is_a( OBJECT:derived_b, derived_a) = no +is_a( STRING:derived_b, derived_a) = no +is_a( STRING:derived_b, derived_a, true) = no +is_subclass_of( OBJECT:derived_b, derived_a) = no +is_subclass_of( STRING:derived_b, derived_a) = no +is_subclass_of( STRING:derived_b, derived_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, derived_a,true) = no +is_a( STRING:undefB, derived_a) = no +is_subclass_of( STRING:undefB, derived_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, derived_a) = no + +>>> With Defined class +is_a( OBJECT:derived_b, if_a) = yes +is_a( STRING:derived_b, if_a) = no +is_a( STRING:derived_b, if_a, true) = yes +is_subclass_of( OBJECT:derived_b, if_a) = yes +is_subclass_of( STRING:derived_b, if_a) = yes +is_subclass_of( STRING:derived_b, if_a,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, if_a,true) = no +is_a( STRING:undefB, if_a) = no +is_subclass_of( STRING:undefB, if_a,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, if_a) = no + +>>> With Defined class +is_a( OBJECT:derived_b, undefA) = no +is_a( STRING:derived_b, undefA) = no +is_a( STRING:derived_b, undefA, true) = no +is_subclass_of( OBJECT:derived_b, undefA) = no +is_subclass_of( STRING:derived_b, undefA) = no +is_subclass_of( STRING:derived_b, undefA,false) = no +>>> With Undefined +>>>> In __autoload: string(6) "undefB" +is_a( STRING:undefB, undefA,true) = no +is_a( STRING:undefB, undefA) = no +is_subclass_of( STRING:undefB, undefA,false) = no +>>>> In __autoload: string(6) "undefB" +is_subclass_of( STRING:undefB, undefA) = no diff --git a/ext/standard/tests/class_object/is_a_error_001.phpt b/ext/standard/tests/class_object/is_a_error_001.phpt index 921e3a260..6518a03c0 100644 --- a/ext/standard/tests/class_object/is_a_error_001.phpt +++ b/ext/standard/tests/class_object/is_a_error_001.phpt @@ -4,7 +4,7 @@ Test is_a() function : error conditions - wrong number of args error_reporting=E_ALL | E_STRICT | E_DEPRECATED --FILE-- <?php -/* Prototype : proto bool is_a(object object, string class_name) +/* Prototype : proto bool is_a(object object, string class_name, bool allow_string) * Description: Returns true if the object is of this class or has this class as one of its parents * Source code: Zend/zend_builtin_functions.c * Alias to functions: @@ -12,13 +12,19 @@ error_reporting=E_ALL | E_STRICT | E_DEPRECATED echo "*** Testing is_a() : error conditions ***\n"; - //Test is_a with one more than the expected number of arguments echo "\n-- Testing is_a() function with more than expected no. of arguments --\n"; $object = new stdclass(); $class_name = 'string_val'; +$allow_string = false; $extra_arg = 10; -var_dump( is_a($object, $class_name, $extra_arg) ); + +var_dump( is_a($object, $class_name, $allow_string, $object) ); + +//Test is_a with one more than the expected number of arguments +echo "\n-- Testing is_a() function with non-boolean in last position --\n"; +var_dump( is_a($object, $class_name, $object) ); + // Testing is_a with one less than the expected number of arguments echo "\n-- Testing is_a() function with less than expected no. of arguments --\n"; @@ -28,15 +34,21 @@ var_dump( is_a($object) ); echo "Done"; ?> --EXPECTF-- + *** Testing is_a() : error conditions *** -- Testing is_a() function with more than expected no. of arguments -- -Warning: is_a() expects exactly 2 parameters, 3 given in %s on line 16 +Warning: is_a() expects at most 3 parameters, 4 given in %s on line 17 +NULL + +-- Testing is_a() function with non-boolean in last position -- + +Warning: is_a() expects parameter 3 to be boolean, object given in %s on line 21 NULL -- Testing is_a() function with less than expected no. of arguments -- -Warning: is_a() expects exactly 2 parameters, 1 given in %s on line 21 +Warning: is_a() expects at least 2 parameters, 1 given in %s on line 27 NULL -Done +Done
\ No newline at end of file diff --git a/ext/standard/tests/class_object/is_subclass_of_error_001.phpt b/ext/standard/tests/class_object/is_subclass_of_error_001.phpt index bc657866d..987dcd47b 100644 --- a/ext/standard/tests/class_object/is_subclass_of_error_001.phpt +++ b/ext/standard/tests/class_object/is_subclass_of_error_001.phpt @@ -15,8 +15,18 @@ echo "*** Testing is_subclass_of() : error conditions ***\n"; echo "\n-- Testing is_subclass_of() function with more than expected no. of arguments --\n"; $object = new stdclass(); $class_name = 'string_val'; +$allow_string = false; $extra_arg = 10; -var_dump( is_subclass_of($object, $class_name, $extra_arg) ); +var_dump( is_subclass_of($object, $class_name, $allow_string, $extra_arg) ); + +//Test is_subclass_of with invalid last argument +echo "\n-- Testing is_subclass_of() function with more than typo style invalid 3rd argument --\n"; +var_dump( is_subclass_of($object, $class_name, $class_name) ); + + +//Test is_subclass_of with invalid last argument +echo "\n-- Testing is_subclass_of() function with more than invalid 3rd argument --\n"; +var_dump( is_subclass_of($object, $class_name, $object) ); // Testing is_subclass_of with one less than the expected number of arguments echo "\n-- Testing is_subclass_of() function with less than expected no. of arguments --\n"; @@ -30,11 +40,19 @@ echo "Done"; -- Testing is_subclass_of() function with more than expected no. of arguments -- -Warning: is_subclass_of() expects exactly 2 parameters, 3 given in %s on line 16 +Warning: is_subclass_of() expects at most 3 parameters, 4 given in %s on line 17 +NULL + +-- Testing is_subclass_of() function with more than typo style invalid 3rd argument -- +bool(false) + +-- Testing is_subclass_of() function with more than invalid 3rd argument -- + +Warning: is_subclass_of() expects parameter 3 to be boolean, object given in %s on line 26 NULL -- Testing is_subclass_of() function with less than expected no. of arguments -- -Warning: is_subclass_of() expects exactly 2 parameters, 1 given in %s on line 21 +Warning: is_subclass_of() expects at least 2 parameters, 1 given in %s on line 31 NULL Done diff --git a/ext/standard/tests/dir/opendir_variation6-win32.phpt b/ext/standard/tests/dir/opendir_variation6-win32.phpt new file mode 100644 index 000000000..f54a2ad4a --- /dev/null +++ b/ext/standard/tests/dir/opendir_variation6-win32.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test opendir() function : usage variations - Different wildcards +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die("skip Valid only on Windows"); +} +?> +--FILE-- +<?php +/* Prototype : mixed opendir(string $path[, resource $context]) + * Description: Open a directory and return a dir_handle + * Source code: ext/standard/dir.c + */ + +/* + * Pass paths containing wildcards to test if opendir() recognises them + */ + +echo "*** Testing opendir() : usage variations ***\n"; +// create the temporary directories +$file_path = dirname(__FILE__); +$dir_path = $file_path . "/opendir_variation6"; +$sub_dir_path = $dir_path . "/sub_dir1"; + +mkdir($dir_path); +mkdir($sub_dir_path); + +// with different wildcard characters + +echo "\n-- Wildcard = '*' --\n"; +var_dump( opendir($file_path . "/opendir_var*") ); +var_dump( opendir($file_path . "/*") ); + +echo "\n-- Wildcard = '?' --\n"; +var_dump( opendir($dir_path . "/sub_dir?") ); +var_dump( opendir($dir_path . "/sub?dir1") ); + +?> +===DONE=== +--CLEAN-- +<?php +$dir_path = dirname(__FILE__) . "/opendir_variation6"; +$sub_dir_path = $dir_path . "/sub_dir1"; + +rmdir($sub_dir_path); +rmdir($dir_path); +?> +--EXPECTF-- +*** Testing opendir() : usage variations *** + +-- Wildcard = '*' -- + +Warning: opendir(%s/opendir_var*,%s/opendir_var*): %s in %s on line %d + +Warning: opendir(%s/opendir_var*): failed to open dir: %s in %s on line %d +bool(false) + +Warning: opendir(%s/*,%s/*): %s in %s on line %d + +Warning: opendir(%s/*): failed to open dir: %s in %s on line %d +bool(false) + +-- Wildcard = '?' -- + +Warning: opendir(%s/opendir_variation6/sub_dir?,%s/opendir_variation6/sub_dir?): %s in %s on line %d + +Warning: opendir(%s/opendir_variation6/sub_dir?): failed to open dir: %s in %s on line %d +bool(false) + +Warning: opendir(%s/opendir_variation6/sub?dir1,%s/opendir_variation6/sub?dir1): %s in %s on line %d + +Warning: opendir(%s/opendir_variation6/sub?dir1): failed to open dir: %s in %s on line %d +bool(false) +===DONE=== diff --git a/ext/standard/tests/directory/open_basedir_001.phpt b/ext/standard/tests/directory/open_basedir_001.phpt deleted file mode 100644 index 092eac27f..000000000 --- a/ext/standard/tests/directory/open_basedir_001.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -openbase_dir runtime tightning ---INI-- -open_basedir=/usr/local ---FILE-- -<?php -var_dump(ini_set("open_basedir", "/usr/local/bin")); -var_dump(ini_get("open_basedir")); -var_dump(ini_set("open_basedir", "/usr")); -var_dump(ini_get("open_basedir")); -?> ---EXPECT-- -string(10) "/usr/local" -string(14) "/usr/local/bin" -bool(false) -string(14) "/usr/local/bin" - diff --git a/ext/standard/tests/file/bug20424.phpt b/ext/standard/tests/file/bug20424.phpt index df10d4abd..b8f9dfd8f 100644 --- a/ext/standard/tests/file/bug20424.phpt +++ b/ext/standard/tests/file/bug20424.phpt @@ -2,7 +2,7 @@ Bug #20424 (stream_get_meta_data crashes on a normal file stream) --FILE-- <?php -$f = fopen(dirname(__FILE__) . "/../../../../run-tests.php", "r"); +$f = fopen(__FILE__, "r"); $dummy = var_export(stream_get_meta_data($f), TRUE); echo "I'm alive!\n"; ?> diff --git a/ext/standard/tests/file/bug52624.phpt b/ext/standard/tests/file/bug52624.phpt new file mode 100644 index 000000000..ee61eb90e --- /dev/null +++ b/ext/standard/tests/file/bug52624.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #52624 (tempnam() by-pass open_basedir with inexistent directory) +--INI-- +open_basedir=. +--FILE-- +<?php + +echo tempnam("directory_that_not_exists", "prefix_"); + +?> +--EXPECTF-- +Warning: tempnam(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s) in %s on line %d diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt new file mode 100644 index 000000000..8915bb833 --- /dev/null +++ b/ext/standard/tests/file/bug60120.phpt @@ -0,0 +1,74 @@ +--TEST--
+Bug #60120 (proc_open hangs when data in stdin/out/err is getting larger or equal to 2048)
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) != 'WIN') {
+ die('skip only for Windows');
+}
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+?>
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+$php = getenv('TEST_PHP_EXECUTABLE');
+if (!$php) {
+ die("No php executable defined\n");
+}
+$cmd = 'php -r "fwrite(STDOUT, $in = file_get_contents(\'php://stdin\')); fwrite(STDERR, $in);"';
+$descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w'));
+$stdin = str_repeat('*', 1024 * 16) . '!';
+$stdin = str_repeat('*', 2049 );
+
+$options = array_merge(array('suppress_errors' => true, 'binary_pipes' => true, 'bypass_shell' => false));
+$process = proc_open($cmd, $descriptors, $pipes, getcwd(), array(), $options);
+
+foreach ($pipes as $pipe) {
+ stream_set_blocking($pipe, false);
+}
+$writePipes = array($pipes[0]);
+$stdinLen = strlen($stdin);
+$stdinOffset = 0;
+
+unset($pipes[0]);
+
+while ($pipes || $writePipes) {
+ $r = $pipes;
+ $w = $writePipes;
+ $e = null;
+ $n = stream_select($r, $w, $e, 60);
+
+ if (false === $n) {
+ break;
+ } elseif ($n === 0) {
+ proc_terminate($process);
+
+ }
+ if ($w) {
+ $written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
+ if (false !== $written) {
+ $stdinOffset += $written;
+ }
+ if ($stdinOffset >= $stdinLen) {
+ fclose($writePipes[0]);
+ $writePipes = null;
+ }
+ }
+
+ foreach ($r as $pipe) {
+ $type = array_search($pipe, $pipes);
+ $data = fread($pipe, 8192);
+ if (false === $data || feof($pipe)) {
+ fclose($pipe);
+ unset($pipes[$type]);
+ }
+ }
+}
+echo "OK.";
+?>
+--EXPECT--
+OK.
diff --git a/ext/standard/tests/file/file_get_contents_error001.phpt b/ext/standard/tests/file/file_get_contents_error001.phpt index ced0da032..127901ad7 100644 --- a/ext/standard/tests/file/file_get_contents_error001.phpt +++ b/ext/standard/tests/file/file_get_contents_error001.phpt @@ -7,6 +7,7 @@ file_get_contents() test using offset parameter out of range display_errors=false --SKIPIF-- <?php + if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (!function_exists("file_get_contents")) die ("skip file_get_contents function is not found"); ?> diff --git a/ext/standard/tests/file/fread_socket_variation1.phpt b/ext/standard/tests/file/fread_socket_variation1.phpt index 50ee79bbf..a615d2f41 100644 --- a/ext/standard/tests/file/fread_socket_variation1.phpt +++ b/ext/standard/tests/file/fread_socket_variation1.phpt @@ -1,15 +1,11 @@ --TEST-- Testing fread() on a TCP server socket ---SKIPIF-- -<?php -if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); -?> --FILE-- <?php $tcp_socket = stream_socket_server('tcp://127.0.0.1:31337'); -socket_set_timeout($tcp_socket, 1); +socket_set_timeout($tcp_socket, 0, 1000); var_dump(fread($tcp_socket, 1)); diff --git a/ext/standard/tests/file/lstat_stat_basic.phpt b/ext/standard/tests/file/lstat_stat_basic.phpt index 362fcfe86..0d1476d68 100644 --- a/ext/standard/tests/file/lstat_stat_basic.phpt +++ b/ext/standard/tests/file/lstat_stat_basic.phpt @@ -2,6 +2,7 @@ Test lstat() & stat() functions: basic functionality --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. lstat() not available on Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation10.phpt b/ext/standard/tests/file/lstat_stat_variation10.phpt index a30b3c51f..51ebc25e7 100644 --- a/ext/standard/tests/file/lstat_stat_variation10.phpt +++ b/ext/standard/tests/file/lstat_stat_variation10.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of is_dir() --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation11.phpt b/ext/standard/tests/file/lstat_stat_variation11.phpt index df1b8ac12..a75504b47 100644 --- a/ext/standard/tests/file/lstat_stat_variation11.phpt +++ b/ext/standard/tests/file/lstat_stat_variation11.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effect of is_file() --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation12.phpt b/ext/standard/tests/file/lstat_stat_variation12.phpt index c1e37b543..8e1edd66c 100644 --- a/ext/standard/tests/file/lstat_stat_variation12.phpt +++ b/ext/standard/tests/file/lstat_stat_variation12.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of is_link() --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. lstat() not available on Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation13.phpt b/ext/standard/tests/file/lstat_stat_variation13.phpt index 474ddc516..288e0b5ec 100644 --- a/ext/standard/tests/file/lstat_stat_variation13.phpt +++ b/ext/standard/tests/file/lstat_stat_variation13.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - file opened using w and r mode --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation15.phpt b/ext/standard/tests/file/lstat_stat_variation15.phpt index 45912ae58..8b67338ab 100644 --- a/ext/standard/tests/file/lstat_stat_variation15.phpt +++ b/ext/standard/tests/file/lstat_stat_variation15.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects changing permissions of link --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. lstat() not available on Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation16.phpt b/ext/standard/tests/file/lstat_stat_variation16.phpt index 641ccd58d..9f1276548 100644 --- a/ext/standard/tests/file/lstat_stat_variation16.phpt +++ b/ext/standard/tests/file/lstat_stat_variation16.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects changing permissions of file --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation17.phpt b/ext/standard/tests/file/lstat_stat_variation17.phpt index e50abf3f8..f2306de79 100644 --- a/ext/standard/tests/file/lstat_stat_variation17.phpt +++ b/ext/standard/tests/file/lstat_stat_variation17.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects changing permissions of dir --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation21.phpt b/ext/standard/tests/file/lstat_stat_variation21.phpt index 1009c92c5..8620ab00d 100644 --- a/ext/standard/tests/file/lstat_stat_variation21.phpt +++ b/ext/standard/tests/file/lstat_stat_variation21.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of truncate() --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation4.phpt b/ext/standard/tests/file/lstat_stat_variation4.phpt index 7407a63bf..259beca00 100755 --- a/ext/standard/tests/file/lstat_stat_variation4.phpt +++ b/ext/standard/tests/file/lstat_stat_variation4.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of touch() on file --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation5.phpt b/ext/standard/tests/file/lstat_stat_variation5.phpt index 895e606b9..d0c096ef1 100755 --- a/ext/standard/tests/file/lstat_stat_variation5.phpt +++ b/ext/standard/tests/file/lstat_stat_variation5.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of touch() on dir --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/lstat_stat_variation6.phpt b/ext/standard/tests/file/lstat_stat_variation6.phpt index b7913e0b3..7e557d034 100755 --- a/ext/standard/tests/file/lstat_stat_variation6.phpt +++ b/ext/standard/tests/file/lstat_stat_variation6.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - effects of touch() on link --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (!(stristr(PHP_OS, 'linux'))) { die('skip.. test valid for linux only'); } @@ -47,7 +48,7 @@ clearstatcache(); var_dump( touch($link_name) ); -$new_stat = lstat($link_name); +$new_stat = stat($file_name); // compare self stats var_dump( compare_self_stat($old_stat) ); diff --git a/ext/standard/tests/file/lstat_stat_variation8.phpt b/ext/standard/tests/file/lstat_stat_variation8.phpt index 412c3bf03..b0f170d1f 100644 --- a/ext/standard/tests/file/lstat_stat_variation8.phpt +++ b/ext/standard/tests/file/lstat_stat_variation8.phpt @@ -2,6 +2,7 @@ Test lstat() and stat() functions: usage variations - creating file/subdir --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. Not valid for Windows'); } diff --git a/ext/standard/tests/file/readlink_realpath_variation3.phpt b/ext/standard/tests/file/readlink_realpath_variation3.phpt index 70e8d0c94..3766a5b43 100644 --- a/ext/standard/tests/file/readlink_realpath_variation3.phpt +++ b/ext/standard/tests/file/readlink_realpath_variation3.phpt @@ -46,32 +46,32 @@ echo "Done\n"; *** Testing readlink() and realpath() with linkname as empty string, NULL and single space *** -- Iteration1 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) %s -- Iteration2 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) %s -- Iteration3 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%s" -- Iteration4 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%s" -- Iteration5 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%s" -- Iteration6 -- -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%s" Done diff --git a/ext/standard/tests/file/readlink_variation1.phpt b/ext/standard/tests/file/readlink_variation1.phpt index 49dc6a540..1dae17cbd 100644 --- a/ext/standard/tests/file/readlink_variation1.phpt +++ b/ext/standard/tests/file/readlink_variation1.phpt @@ -50,28 +50,28 @@ unlink($file_path."/readlink_variation2.tmp"); --EXPECTF-- *** Testing Invalid file types *** -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) Warning: readlink() expects parameter 1 to be string, resource given in %s on line %d NULL -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) -Warning: readlink(): No such file or directory in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) *** Done *** diff --git a/ext/standard/tests/file/rename_variation13-win32.phpt b/ext/standard/tests/file/rename_variation13-win32.phpt index 2cd9dbdd9..8e86d27a2 100644 --- a/ext/standard/tests/file/rename_variation13-win32.phpt +++ b/ext/standard/tests/file/rename_variation13-win32.phpt @@ -36,6 +36,9 @@ $names_arr = array( ); +/* disable notice so we don't get the array to string conversion notice for "$name" where $name = array() */ +error_reporting(E_ALL ^ E_NOTICE); + echo "*** Testing rename() with obscure files ***\n"; $file_path = dirname(__FILE__)."/renameVar13"; $aFile = $file_path.'/afile.tmp'; diff --git a/ext/standard/tests/file/rename_variation6-win32.phpt b/ext/standard/tests/file/rename_variation6-win32.phpt index 14d59d0ad..9aab0a7a8 100644 --- a/ext/standard/tests/file/rename_variation6-win32.phpt +++ b/ext/standard/tests/file/rename_variation6-win32.phpt @@ -33,7 +33,7 @@ var_dump(file_exists($tmp_file)); echo "Done\n"; ?> --EXPECTF-- -Warning: readlink(): Could not open file (error 2) in %s on line %d +Warning: readlink(): %s in %s on line %d bool(false) string(%d) "%srename_variation6-win32.php.tmp" bool(true) diff --git a/ext/standard/tests/file/touch_basic.phpt b/ext/standard/tests/file/touch_basic.phpt index fb042df67..c41fdf1d7 100644 --- a/ext/standard/tests/file/touch_basic.phpt +++ b/ext/standard/tests/file/touch_basic.phpt @@ -4,6 +4,7 @@ Test touch() function : basic functionality Dave Kelsey <d_kelsey@uk.ibm.com> --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip.. only for Non Windows'); } diff --git a/ext/standard/tests/general_functions/bug39322.phpt b/ext/standard/tests/general_functions/bug39322.phpt index 6ba740dc8..a9f83c75b 100644 --- a/ext/standard/tests/general_functions/bug39322.phpt +++ b/ext/standard/tests/general_functions/bug39322.phpt @@ -2,6 +2,7 @@ Bug #39322 (proc_terminate() loosing process resource) --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (!is_executable('/bin/sleep')) echo 'skip sleep not found'; ?> --FILE-- @@ -15,7 +16,7 @@ $pipes = array(); $process = proc_open('/bin/sleep 120', $descriptors, $pipes); -proc_terminate($process); +proc_terminate($process, 9); sleep(1); // wait a bit to let the process finish var_dump(proc_get_status($process)); @@ -37,7 +38,7 @@ array(8) { ["exitcode"]=> int(-1) ["termsig"]=> - int(15) + int(9) ["stopsig"]=> int(0) } diff --git a/ext/standard/tests/general_functions/call_user_method_002.phpt b/ext/standard/tests/general_functions/call_user_method_002.phpt new file mode 100644 index 000000000..054bc3ede --- /dev/null +++ b/ext/standard/tests/general_functions/call_user_method_002.phpt @@ -0,0 +1,12 @@ +--TEST-- +call_user_method() Invalid free +--FILE-- +<?php + +call_user_method("1", $arr1); + +?> +--EXPECTF-- +Deprecated: Function call_user_method() is deprecated in %s on line %d + +Warning: call_user_method(): Second argument is not an object or class name in %s on line %d diff --git a/ext/standard/tests/general_functions/parse_ini_file-win32.phpt b/ext/standard/tests/general_functions/parse_ini_file-win32.phpt deleted file mode 100644 index 7a1d63010..000000000 --- a/ext/standard/tests/general_functions/parse_ini_file-win32.phpt +++ /dev/null @@ -1,196 +0,0 @@ ---TEST-- -parse_ini_file() multiple calls ---SKIPIF-- -<?php if( substr(PHP_OS, 0, 3) != 'WIN' ) die("skip non Windows systems have different error message");?> ---FILE-- -<?php - -$filename = dirname(__FILE__)."/parse_ini_file.dat"; -@unlink($filename); /* Make sure the file really does not exist! */ - -var_dump(parse_ini_file()); -var_dump(parse_ini_file(1,1,1,1)); -var_dump(parse_ini_file($filename)); -var_dump(parse_ini_file($filename, true)); - -$ini = " -test = -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename)); -$ini = " -test== -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename)); - -$ini = " -test=test= -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename)); - -$ini = " -test= \"new -line\" -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename)); - -define("TEST_CONST", "test const value"); -$ini = " -test=TEST_CONST -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename)); - -$ini = " -[section] -test=hello -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, true)); - -$ini = " -[section] -test=hello -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, false)); - -$ini = " -section.test=hello -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, true)); - -$ini = " -[section] -section.test=hello -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, true)); - -$ini = " -[section] -1=2 -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, true)); - -$ini = " -1=2 -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, true)); -$ini = " -test=test2 -test=test3 -test=test4 -"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, true)); - -/* From bug #44574 */ -$ini = "[section1]\nname = value"; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, true)); - -/* #44842, labels starting with underscore */ -$ini = <<<'INI' -foo=bar1 -_foo=bar2 -foo_=bar3 -INI; -file_put_contents($filename, $ini); -var_dump(parse_ini_file($filename, true)); - -@unlink($filename); -echo "Done\n"; -?> ---EXPECTF-- -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %s on line 6 -bool(false) - -Warning: parse_ini_file() expects at most 3 parameters, 4 given in %s on line 7 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s.php on line 8 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %s.php on line 9 -bool(false) -array(1) { - ["test"]=> - string(0) "" -} - -Warning: parse error in %s on line %d - in %s on line 20 -bool(false) - -Warning: parse error in %s on line %d - in %s on line 26 -bool(false) -array(1) { - ["test"]=> - string(8) "new -line" -} -array(1) { - ["test"]=> - string(16) "test const value" -} -array(1) { - ["section"]=> - array(1) { - ["test"]=> - string(5) "hello" - } -} -array(1) { - ["test"]=> - string(5) "hello" -} -array(1) { - ["section.test"]=> - string(5) "hello" -} -array(1) { - ["section"]=> - array(1) { - ["section.test"]=> - string(5) "hello" - } -} -array(1) { - ["section"]=> - array(1) { - [1]=> - string(1) "2" - } -} -array(1) { - [1]=> - string(1) "2" -} -array(1) { - ["test"]=> - string(5) "test4" -} -array(1) { - ["section1"]=> - array(1) { - ["name"]=> - string(5) "value" - } -} -array(3) { - ["foo"]=> - string(4) "bar1" - ["_foo"]=> - string(4) "bar2" - ["foo_"]=> - string(4) "bar3" -} -Done diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt index 8523c83cf..240b0f3b1 100644 --- a/ext/standard/tests/general_functions/parse_ini_file.phpt +++ b/ext/standard/tests/general_functions/parse_ini_file.phpt @@ -137,11 +137,11 @@ array(1) { string(0) "" } -Warning: syntax error, unexpected '=' in %sparse_ini_file.dat on line 2 +Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 in %sparse_ini_file.php on line 20 bool(false) -Warning: syntax error, unexpected '=' in %sparse_ini_file.dat on line 2 +Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 in %sparse_ini_file.php on line 26 bool(false) array(1) { diff --git a/ext/standard/tests/general_functions/parse_ini_string_002.phpt b/ext/standard/tests/general_functions/parse_ini_string_002.phpt index 0da959ab8..733409c84 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_002.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt @@ -97,11 +97,11 @@ array(1) { %unicode|string%(0) "" } -Warning: syntax error, unexpected '=' in Unknown on line 2 +Warning: syntax error, unexpected '='%sin Unknown on line 2 in %s bool(false) -Warning: syntax error, unexpected '=' in Unknown on line 2 +Warning: syntax error, unexpected '='%sin Unknown on line 2 in %s bool(false) array(1) { diff --git a/ext/standard/tests/general_functions/proc_open02.phpt b/ext/standard/tests/general_functions/proc_open02.phpt index 3406f6806..d5d878ed2 100644 --- a/ext/standard/tests/general_functions/proc_open02.phpt +++ b/ext/standard/tests/general_functions/proc_open02.phpt @@ -3,7 +3,6 @@ proc_open --SKIPIF-- <?php if (!is_executable('/bin/sleep')) echo 'skip no sleep'; -if (!is_executable('/usr/bin/nohup')) echo 'skip no nohup'; if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test'; ?> --FILE-- @@ -11,19 +10,19 @@ if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test'; $ds = array(array('pipe', 'r')); $cat = proc_open( - '/usr/bin/nohup /bin/sleep 50', + '/bin/sleep 2', $ds, $pipes ); -sleep(1); // let the OS run the nohup process before sending the signal +usleep(20000); // let the OS run the sleep process before sending the signal -var_dump(proc_terminate($cat, 1)); // send a SIGHUP -sleep(1); +var_dump(proc_terminate($cat, 0)); // status check +usleep(20000); var_dump(proc_get_status($cat)); var_dump(proc_terminate($cat)); // now really quit it -sleep(1); +usleep(20000); var_dump(proc_get_status($cat)); proc_close($cat); @@ -35,7 +34,7 @@ echo "Done!\n"; bool(true) array(8) { ["command"]=> - string(28) "/usr/bin/nohup /bin/sleep 50" + string(12) "/bin/sleep 2" ["pid"]=> int(%d) ["running"]=> @@ -54,7 +53,7 @@ array(8) { bool(true) array(8) { ["command"]=> - string(28) "/usr/bin/nohup /bin/sleep 50" + string(12) "/bin/sleep 2" ["pid"]=> int(%d) ["running"]=> diff --git a/ext/standard/tests/general_functions/sleep_basic.phpt b/ext/standard/tests/general_functions/sleep_basic.phpt index cfc00c6ea..5d7fe536f 100644 --- a/ext/standard/tests/general_functions/sleep_basic.phpt +++ b/ext/standard/tests/general_functions/sleep_basic.phpt @@ -1,5 +1,9 @@ --TEST-- Test sleep() function : basic functionality +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +?> --FILE-- <?php /* Prototype : int sleep ( int $seconds ) diff --git a/ext/standard/tests/general_functions/usleep_basic.phpt b/ext/standard/tests/general_functions/usleep_basic.phpt index 22c3e658b..d6f312e15 100644 --- a/ext/standard/tests/general_functions/usleep_basic.phpt +++ b/ext/standard/tests/general_functions/usleep_basic.phpt @@ -1,5 +1,9 @@ --TEST-- Test usleep() function +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +?> --FILE-- <?php /* Prototype : void usleep ( int $micro_seconds ) diff --git a/ext/standard/tests/http/bug38802.phpt b/ext/standard/tests/http/bug38802.phpt index 91fd1cce9..73b41183a 100644 --- a/ext/standard/tests/http/bug38802.phpt +++ b/ext/standard/tests/http/bug38802.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #38802 (ignore_errors and max_redirects) +--INI-- +allow_url_fopen=1 --SKIPIF-- <?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?> --FILE-- diff --git a/ext/standard/tests/http/bug43510.phpt b/ext/standard/tests/http/bug43510.phpt index 7358ee12c..d97361237 100644 --- a/ext/standard/tests/http/bug43510.phpt +++ b/ext/standard/tests/http/bug43510.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #43510 (stream_get_meta_data() does not return same mode as used in fopen) +--INI-- +allow_url_fopen=1 --SKIPIF-- <?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?> --FILE-- diff --git a/ext/standard/tests/http/bug48929.phpt b/ext/standard/tests/http/bug48929.phpt index 035ebb12b..2d1e45917 100644 --- a/ext/standard/tests/http/bug48929.phpt +++ b/ext/standard/tests/http/bug48929.phpt @@ -1,5 +1,7 @@ --TEST-- Bug #48929 (duplicate \r\n sent after last header line) +--INI-- +allow_url_fopen=1 --SKIPIF-- <?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?> --FILE-- diff --git a/ext/standard/tests/http/bug53198.phpt b/ext/standard/tests/http/bug53198.phpt index fe26bc952..3c640fa9c 100644 --- a/ext/standard/tests/http/bug53198.phpt +++ b/ext/standard/tests/http/bug53198.phpt @@ -1,56 +1,57 @@ ---TEST--
-Bug #53198 (From: header cannot be changed with ini_set)
---SKIPIF--
-<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
---INI--
-from=teste@teste.pt
---FILE--
-<?php
-require 'server.inc';
-
-function do_test() {
-
- $responses = array(
- "data://text/plain,HTTP/1.0 200 OK\r\n\r\n",
- );
-
- $pid = http_server("tcp://127.0.0.1:12342", $responses, $output);
-
- foreach($responses as $r) {
-
- $fd = fopen('http://127.0.0.1:12342/', 'rb', false);
-
- fseek($output, 0, SEEK_SET);
- var_dump(stream_get_contents($output));
- fseek($output, 0, SEEK_SET);
- }
-
- http_server_kill($pid);
-
-}
-
-echo "-- Test: leave default --\n";
-
-do_test();
-
-echo "-- Test: after ini_set --\n";
-
-ini_set('from', 'junk@junk.com');
-
-do_test();
-
-?>
---EXPECT--
--- Test: leave default --
-string(63) "GET / HTTP/1.0
-From: teste@teste.pt
-Host: 127.0.0.1:12342
-
-"
--- Test: after ini_set --
-string(62) "GET / HTTP/1.0
-From: junk@junk.com
-Host: 127.0.0.1:12342
-
-"
-
+--TEST-- +Bug #53198 (From: header cannot be changed with ini_set) +--SKIPIF-- +<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?> +--INI-- +allow_url_fopen=1 +from=teste@teste.pt +--FILE-- +<?php +require 'server.inc'; + +function do_test() { + + $responses = array( + "data://text/plain,HTTP/1.0 200 OK\r\n\r\n", + ); + + $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); + + foreach($responses as $r) { + + $fd = fopen('http://127.0.0.1:12342/', 'rb', false); + + fseek($output, 0, SEEK_SET); + var_dump(stream_get_contents($output)); + fseek($output, 0, SEEK_SET); + } + + http_server_kill($pid); + +} + +echo "-- Test: leave default --\n"; + +do_test(); + +echo "-- Test: after ini_set --\n"; + +ini_set('from', 'junk@junk.com'); + +do_test(); + +?> +--EXPECT-- +-- Test: leave default -- +string(63) "GET / HTTP/1.0 +From: teste@teste.pt +Host: 127.0.0.1:12342 + +" +-- Test: after ini_set -- +string(62) "GET / HTTP/1.0 +From: junk@junk.com +Host: 127.0.0.1:12342 + +" + diff --git a/ext/standard/tests/http/bug60570.phpt b/ext/standard/tests/http/bug60570.phpt new file mode 100644 index 000000000..d1784b055 --- /dev/null +++ b/ext/standard/tests/http/bug60570.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #60570 (Stream context leaks when http request fails) +--SKIPIF-- +<?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?> +--INI-- +allow_url_fopen=1 +allow_url_include=1 +--FILE-- +<?php +require 'server.inc'; + +function do_test() { + + $responses = array( + "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", + "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", + "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n" + ); + + $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); + + $a = $b = null; + + $i = 3; + while ($i--) { + $context = stream_context_create(array('http'=>array('timeout'=>1))); + file_get_contents('http://127.0.0.1:12342/', 0, $context); + unset($context); + + $b = $a; + $a = memory_get_usage(); + } + + http_server_kill($pid); + + echo "leak? penultimate iteration: $b, last one: $a\n"; + var_dump($a == $b); +} + +do_test(); + +--EXPECTF-- +Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found + in %s on line %d + +Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found + in %s on line %d + +Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found + in %s on line %d +leak? penultimate iteration: %d, last one: %d +bool(true) + diff --git a/ext/standard/tests/http/ignore_errors.phpt b/ext/standard/tests/http/ignore_errors.phpt index c7e1acbfe..ab5421890 100644 --- a/ext/standard/tests/http/ignore_errors.phpt +++ b/ext/standard/tests/http/ignore_errors.phpt @@ -1,5 +1,7 @@ --TEST-- http:// and ignore_errors +--INI-- +allow_url_fopen=1 --SKIPIF-- <?php require 'server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?> --FILE-- 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 new file mode 100644 index 000000000..b81bdbde5 --- /dev/null +++ b/ext/standard/tests/image/image_type_to_mime_type_basic.phpt @@ -0,0 +1,63 @@ +--TEST-- +image_type_to_mime_type() +--SKIPIF-- +<?php + if (!function_exists('image_type_to_mime_type')) die('skip image_type_to_mime_type() not available'); +?> +--FILE-- +<?php + +/* Prototype : string image_type_to_mime_type ( int $imagetype ) + * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype. + * Source code: ext/standard/image.c + * Alias to functions: + */ + +echo "Starting image_type_to_mime_type() test\n\n"; + +$image_types = array ( + IMAGETYPE_GIF, + IMAGETYPE_JPEG, + IMAGETYPE_PNG, + IMAGETYPE_SWF, + IMAGETYPE_PSD, + IMAGETYPE_BMP, + IMAGETYPE_TIFF_II, + IMAGETYPE_TIFF_MM, + IMAGETYPE_JPC, + IMAGETYPE_JP2, + IMAGETYPE_JPX, + IMAGETYPE_JB2, + IMAGETYPE_IFF, + IMAGETYPE_WBMP, + IMAGETYPE_JPEG2000, + IMAGETYPE_XBM +); + + foreach($image_types as $image_type) { + var_dump(image_type_to_mime_type($image_type)); + } + +echo "\nDone image_type_to_mime_type() test\n"; +?> +--EXPECT-- +Starting image_type_to_mime_type() test + +string(9) "image/gif" +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(10) "image/tiff" +string(10) "image/tiff" +string(24) "application/octet-stream" +string(9) "image/jp2" +string(24) "application/octet-stream" +string(24) "application/octet-stream" +string(9) "image/iff" +string(18) "image/vnd.wap.wbmp" +string(24) "application/octet-stream" +string(9) "image/xbm" + +Done image_type_to_mime_type() test diff --git a/ext/standard/tests/image/image_type_to_mime_type_error.phpt b/ext/standard/tests/image/image_type_to_mime_type_error.phpt new file mode 100644 index 000000000..88aacbf17 --- /dev/null +++ b/ext/standard/tests/image/image_type_to_mime_type_error.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test image_type_to_mime_type() function : error conditions - Pass incorrect number of arguments +--FILE-- +<?php +/* Prototype : proto string image_type_to_mime_type(int imagetype) + * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype + * Source code: ext/standard/image.c + */ + +$imagetype = IMAGETYPE_GIF; +$extra_arg = 10; +echo "*** Testing image_type_to_mime_type() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing image_type_to_mime_type() function with Zero arguments --\n"; +var_dump( image_type_to_mime_type() ); + +//Test image_type_to_mime_type with one more than the expected number of arguments +echo "\n-- Testing image_type_to_mime_type() function with more than expected no. of arguments --\n"; +var_dump( image_type_to_mime_type($imagetype, $extra_arg) ); +?> +===DONE=== +--EXPECTF-- +*** Testing image_type_to_mime_type() : error conditions *** + +-- Testing image_type_to_mime_type() function with Zero arguments -- + +Warning: image_type_to_mime_type() expects exactly 1 parameter, 0 given in %simage_type_to_mime_type_error.php on line 13 +NULL + +-- Testing image_type_to_mime_type() function with more than expected no. of arguments -- + +Warning: image_type_to_mime_type() expects exactly 1 parameter, 2 given in %simage_type_to_mime_type_error.php on line 17 +NULL +===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt new file mode 100644 index 000000000..0023b7125 --- /dev/null +++ b/ext/standard/tests/image/image_type_to_mime_type_variation1.phpt @@ -0,0 +1,152 @@ +--TEST-- +Test image_type_to_mime_type() function : usage variations - Pass different data types as imagetype +--FILE-- +<?php +/* Prototype : string image_type_to_mime_type(int imagetype) + * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype + * Source code: ext/standard/image.c + */ + +echo "*** Testing image_type_to_mime_type() : usage variations ***\n"; + +error_reporting(E_ALL ^ E_NOTICE); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +class MyClass +{ + function __toString() { + return "MyClass"; + } +} + +//array of values to iterate over +$values = array( + + // float data + 100.5, + -100.5, + 100.1234567e10, + 100.7654321E-10, + .5, + + // array data + array(), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new MyClass(), + + // undefined data + @$undefined_var, + + // unset data + @$unset_var, +); + +// loop through each element of the array for imagetype +$iterator = 1; +foreach($values as $value) { + echo "\n-- Iteration $iterator --\n"; + var_dump( image_type_to_mime_type($value) ); + $iterator++; +}; +?> +===DONE=== +--EXPECTF-- +*** Testing image_type_to_mime_type() : usage variations *** + +-- Iteration 1 -- +string(24) "application/octet-stream" + +-- Iteration 2 -- +string(24) "application/octet-stream" + +-- Iteration 3 -- +string(24) "application/octet-stream" + +-- Iteration 4 -- +string(24) "application/octet-stream" + +-- Iteration 5 -- +string(24) "application/octet-stream" + +-- Iteration 6 -- + +Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d +NULL + +-- Iteration 7 -- + +Warning: image_type_to_mime_type() expects parameter 1 to be long, array given in %s on line %d +NULL + +-- Iteration 8 -- +string(24) "application/octet-stream" + +-- Iteration 9 -- +string(24) "application/octet-stream" + +-- Iteration 10 -- +string(9) "image/gif" + +-- Iteration 11 -- +string(24) "application/octet-stream" + +-- Iteration 12 -- +string(9) "image/gif" + +-- Iteration 13 -- +string(24) "application/octet-stream" + +-- Iteration 14 -- + +Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d +NULL + +-- Iteration 15 -- + +Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d +NULL + +-- Iteration 16 -- + +Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d +NULL + +-- Iteration 17 -- + +Warning: image_type_to_mime_type() expects parameter 1 to be long, string given in %s on line %d +NULL + +-- Iteration 18 -- + +Warning: image_type_to_mime_type() expects parameter 1 to be long, object given in %s on line %d +NULL + +-- Iteration 19 -- +string(24) "application/octet-stream" + +-- Iteration 20 -- +string(24) "application/octet-stream" +===DONE===
\ No newline at end of file diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt new file mode 100644 index 000000000..141bc576f --- /dev/null +++ b/ext/standard/tests/image/image_type_to_mime_type_variation2.phpt @@ -0,0 +1,80 @@ +--TEST-- +Test image_type_to_mime_type() function : usage variations - Pass decimal, octal, and hexadecimal values as imagetype +--FILE-- +<?php +/* Prototype : string image_type_to_mime_type(int imagetype) + * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype + * Source code: ext/standard/image.c + */ + +echo "*** Testing image_type_to_mime_type() : usage variations ***\n"; + +error_reporting(E_ALL ^ E_NOTICE); +$values = array ( + //Decimal values + 0, + 1, + 12345, + -12345, + + //Octal values + 02, + 010, + 030071, + -030071, + + //Hexadecimal values + 0x0, + 0x1, + 0xABCD, + -0xABCD +); + +// loop through each element of the array for imagetype +$iterator = 1; +foreach($values as $value) { + echo "\n-- Iteration $iterator --\n"; + var_dump( image_type_to_mime_type($value) ); + $iterator++; +}; +?> +===DONE=== +--EXPECT-- +*** Testing image_type_to_mime_type() : usage variations *** + +-- Iteration 1 -- +string(24) "application/octet-stream" + +-- Iteration 2 -- +string(9) "image/gif" + +-- Iteration 3 -- +string(24) "application/octet-stream" + +-- Iteration 4 -- +string(24) "application/octet-stream" + +-- Iteration 5 -- +string(10) "image/jpeg" + +-- Iteration 6 -- +string(10) "image/tiff" + +-- Iteration 7 -- +string(24) "application/octet-stream" + +-- Iteration 8 -- +string(24) "application/octet-stream" + +-- Iteration 9 -- +string(24) "application/octet-stream" + +-- Iteration 10 -- +string(9) "image/gif" + +-- Iteration 11 -- +string(24) "application/octet-stream" + +-- Iteration 12 -- +string(24) "application/octet-stream" +===DONE=== diff --git a/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt b/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt new file mode 100644 index 000000000..a67bb86a6 --- /dev/null +++ b/ext/standard/tests/image/image_type_to_mime_type_variation4.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test image_type_to_mime_type() function : usage variations - Passing IMAGETYPE_ICO and IMAGETYPE_SWC +--SKIPIF-- +<?php + if (!defined("IMAGETYPE_SWC") || !defined("IMAGETYPE_ICO") || !extension_loaded('zlib')) { + die("skip zlib extension is not available or IMAGETYPE_SWC/IMAGETYPE_ICO is not defined "); + } +?> +--FILE-- +<?php +/* Prototype : string image_type_to_mime_type(int imagetype) + * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype + * Source code: ext/standard/image.c + */ + + +echo "*** Testing image_type_to_mime_type() : usage variations ***\n"; + +error_reporting(E_ALL ^ E_NOTICE); + +var_dump( image_type_to_mime_type(IMAGETYPE_ICO) ); +var_dump( image_type_to_mime_type(IMAGETYPE_SWC) ); +?> +===DONE=== +--EXPECT-- +*** Testing image_type_to_mime_type() : usage variations *** +string(24) "image/vnd.microsoft.icon" +string(29) "application/x-shockwave-flash" +===DONE=== diff --git a/ext/standard/tests/misc/time_sleep_until_basic.phpt b/ext/standard/tests/misc/time_sleep_until_basic.phpt index 956985a62..9ae912881 100644 --- a/ext/standard/tests/misc/time_sleep_until_basic.phpt +++ b/ext/standard/tests/misc/time_sleep_until_basic.phpt @@ -1,16 +1,20 @@ --TEST-- time_sleep_until() function - basic test for time_sleep_until() --SKIPIF-- -<?php if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available');?> +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +if (!function_exists("time_sleep_until")) die('skip time_sleep_until() not available'); +?> --CREDITS-- Manuel Baldassarri mb@ideato.it Michele Orselli mo@ideato.it #PHPTestFest Cesena Italia on 2009-06-20 --FILE-- <?php - $time = time() + 2; - time_sleep_until( $time ); - var_dump( time() >= $time ); + $time = microtime(true) + 2; + var_dump(time_sleep_until( (int)$time )); + var_dump(microtime(true) >= (int)$time); ?> --EXPECT-- bool(true) +bool(true) diff --git a/ext/standard/tests/network/bug41347.phpt b/ext/standard/tests/network/bug41347.phpt index 21fc002fa..6ece09819 100644 --- a/ext/standard/tests/network/bug41347.phpt +++ b/ext/standard/tests/network/bug41347.phpt @@ -1,11 +1,5 @@ --TEST-- dns_check_record() segfault with empty host ---SKIPIF-- -<?php -if (substr(PHP_OS, 0, 3) == 'WIN') { - die('skip No windows support'); -} -?> --FILE-- <?php var_dump(dns_check_record('')); diff --git a/ext/standard/tests/network/gethostbyaddr_basic1.phpt b/ext/standard/tests/network/gethostbyaddr_basic1.phpt index 2232d3626..a20b4756c 100644 --- a/ext/standard/tests/network/gethostbyaddr_basic1.phpt +++ b/ext/standard/tests/network/gethostbyaddr_basic1.phpt @@ -14,5 +14,5 @@ echo gethostbyaddr("127.0.0.1")."\n"; ===DONE=== --EXPECTF-- *** Testing gethostbyaddr() : basic functionality *** -%rloopback|localhost(\.localdomain)?%r -===DONE===
\ No newline at end of file +%rloopback|localhost(\.localdomain)?|%s%r +===DONE=== diff --git a/ext/standard/tests/network/gethostbyname_basic001.phpt b/ext/standard/tests/network/gethostbyname_basic001.phpt index 0cfc1b4f5..e917b5992 100644 --- a/ext/standard/tests/network/gethostbyname_basic001.phpt +++ b/ext/standard/tests/network/gethostbyname_basic001.phpt @@ -2,6 +2,10 @@ gethostbyname() function - basic type return test --CREDITS-- "Sylvain R." <sracine@phpquebec.org> +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +?> --FILE-- <?php var_dump(is_string(gethostbyname("www.php.net"))); diff --git a/ext/standard/tests/network/gethostbyname_basic002.phpt b/ext/standard/tests/network/gethostbyname_basic002.phpt index b4e191bfc..983faa929 100644 --- a/ext/standard/tests/network/gethostbyname_basic002.phpt +++ b/ext/standard/tests/network/gethostbyname_basic002.phpt @@ -2,6 +2,10 @@ gethostbyname() function - basic invalid parameter test --CREDITS-- "Sylvain R." <sracine@phpquebec.org> +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +?> --FILE-- <?php $ip = gethostbyname("www.php.net"); diff --git a/ext/standard/tests/network/gethostbyname_error004.phpt b/ext/standard/tests/network/gethostbyname_error004.phpt index 1d0f7d7a1..7aac17292 100644 --- a/ext/standard/tests/network/gethostbyname_error004.phpt +++ b/ext/standard/tests/network/gethostbyname_error004.phpt @@ -2,6 +2,10 @@ gethostbyname() function - basic return valid ip address test --CREDITS-- "Sylvain R." <sracine@phpquebec.org> +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +?> --FILE-- <?php $ip = gethostbyname("www.php.net"); diff --git a/ext/standard/tests/network/getmxrr.phpt b/ext/standard/tests/network/getmxrr.phpt index b6753f0d6..29cea1d71 100644 --- a/ext/standard/tests/network/getmxrr.phpt +++ b/ext/standard/tests/network/getmxrr.phpt @@ -2,13 +2,14 @@ getmxrr() test --SKIPIF-- <?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); if (substr(PHP_OS, 0, 3) == 'WIN') { die('skip: no Windows support'); } ?> --FILE-- <?php -$domains = array( 'php.net', 'lists.php.net' ); +$domains = array( 'mx1.tests.php.net', 'mx2.tests.php.net' ); foreach ( $domains as $domain ) { if ( getmxrr( $domain, $hosts, $weights ) ) @@ -18,5 +19,5 @@ foreach ( $domains as $domain ) } ?> --EXPECT-- -Hosts: 2, weights: 2 Hosts: 1, weights: 1 +Hosts: 2, weights: 2 diff --git a/ext/standard/tests/network/http-stream.phpt b/ext/standard/tests/network/http-stream.phpt index e70caf982..6ee035a24 100644 --- a/ext/standard/tests/network/http-stream.phpt +++ b/ext/standard/tests/network/http-stream.phpt @@ -1,7 +1,10 @@ --TEST-- http-stream test --SKIPIF-- -<?php if (!extension_loaded("dom")) die("skip dom extension is not present"); ?> +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +if (!extension_loaded("dom")) die("skip dom extension is not present"); +?> --INI-- allow_url_fopen=1 --FILE-- diff --git a/ext/standard/tests/network/ip2long_variation1.phpt b/ext/standard/tests/network/ip2long_variation1.phpt index ac3c9c81e..ca67aa41a 100644 --- a/ext/standard/tests/network/ip2long_variation1.phpt +++ b/ext/standard/tests/network/ip2long_variation1.phpt @@ -1,5 +1,10 @@ --TEST-- Test ip2long() function : usage variation +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) == "WIN") + die("skip. Windows is more compliant (like 0 for localhost, etc.)"); +?> --FILE-- <?php /* Prototype : int ip2long(string ip_address) diff --git a/ext/standard/tests/php_ini_loaded_file.phpt b/ext/standard/tests/php_ini_loaded_file.phpt index 7958eb127..747e0196f 100644 --- a/ext/standard/tests/php_ini_loaded_file.phpt +++ b/ext/standard/tests/php_ini_loaded_file.phpt @@ -11,4 +11,4 @@ precision=12 var_dump(php_ini_loaded_file()); ?> --EXPECTF-- -string(%d) "%s/tmp-php.ini" +string(%d) "%sphp.ini" diff --git a/ext/standard/tests/serialize/bug55798.phpt b/ext/standard/tests/serialize/bug55798.phpt new file mode 100644 index 000000000..df8443b1f --- /dev/null +++ b/ext/standard/tests/serialize/bug55798.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #55798 (serialize followed by unserialize with numeric object prop. gives integer prop) +--FILE-- +<?php + +$a = new stdClass(); +$a->{0} = 'X'; +$a->{1} = 'Y'; +var_dump(serialize($a)); +var_dump($a->{0}); +$b = unserialize(serialize($a)); +var_dump(serialize($b)); +var_dump($b->{0}); +--EXPECT-- +string(51) "O:8:"stdClass":2:{s:1:"0";s:1:"X";s:1:"1";s:1:"Y";}" +string(1) "X" +string(51) "O:8:"stdClass":2:{s:1:"0";s:1:"X";s:1:"1";s:1:"Y";}" +string(1) "X" diff --git a/ext/standard/tests/serialize/serialization_miscTypes_001.phpt b/ext/standard/tests/serialize/serialization_miscTypes_001.phpt Binary files differindex 038068249..8b974d475 100644 --- a/ext/standard/tests/serialize/serialization_miscTypes_001.phpt +++ b/ext/standard/tests/serialize/serialization_miscTypes_001.phpt diff --git a/ext/standard/tests/streams/bug46024.phpt b/ext/standard/tests/streams/bug46024.phpt index 3f2a5f836..fdfd03ee2 100644 --- a/ext/standard/tests/streams/bug46024.phpt +++ b/ext/standard/tests/streams/bug46024.phpt @@ -4,7 +4,7 @@ Bug #46024 stream_select() doesn't return the correct number <?php if (!getenv('TEST_PHP_EXECUTABLE')) die("skip TEST_PHP_EXECUTABLE not defined"); ?> --FILE-- <?php -$php = getenv('TEST_PHP_EXECUTABLE'); +$php = realpath(getenv('TEST_PHP_EXECUTABLE')); $pipes = array(); $proc = proc_open( "$php -n -i" diff --git a/ext/standard/tests/streams/bug54946.phpt b/ext/standard/tests/streams/bug54946.phpt index b3fa73df5..b51d593a9 100644 --- a/ext/standard/tests/streams/bug54946.phpt +++ b/ext/standard/tests/streams/bug54946.phpt @@ -2,33 +2,32 @@ Bug#54946 stream_get_contents infinite loop --FILE-- <?php -$filename = tempnam(sys_get_temp_dir(), "phpbug"); - +$filename = tempnam(__DIR__, "phpbug"); $stream = fopen($filename, "w"); // w or a $retval = stream_get_contents($stream, 1, 1); - +fclose($stream); var_dump($retval); unlink($filename); -$filename = tempnam(sys_get_temp_dir(), "phpbug2"); +$filename = tempnam(__DIR__, "phpbug2"); $stream = fopen($filename, "a"); $retval = stream_get_contents($stream, 1, 1); - var_dump($retval); +fclose($stream); unlink($filename); -$filename = tempnam(sys_get_temp_dir(), "phpbug3"); +$filename = tempnam(__DIR__, "phpbug3"); $stream = fopen($filename, "a"); fseek($stream, 1); $retval = stream_get_contents($stream, 1); - var_dump($retval); +fclose($stream); unlink($filename); ?> ===DONE=== diff --git a/ext/standard/tests/streams/bug60455_01.phpt b/ext/standard/tests/streams/bug60455_01.phpt new file mode 100644 index 000000000..466998201 --- /dev/null +++ b/ext/standard/tests/streams/bug60455_01.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #60455: stream_get_line and 1-line noeol input +--FILE-- +<?php + +//It's critical the read on the stream returns the input but doesn't set EOF +//flag the first time. This is why we need to use sockets. + +$domain = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' ? STREAM_PF_INET : STREAM_PF_UNIX); +$sockets = stream_socket_pair($domain, STREAM_SOCK_STREAM, STREAM_IPPROTO_IP) + or die("stream_socket_pair"); +fwrite($sockets[0], "a"); +stream_socket_shutdown($sockets[0], STREAM_SHUT_RDWR); + +$f = $sockets[1]; +while (!feof($f)) { + $line = stream_get_line($f, 99, "\n"); + var_dump($line); +} +--EXPECT-- +string(1) "a" diff --git a/ext/standard/tests/streams/bug60455_02.phpt b/ext/standard/tests/streams/bug60455_02.phpt new file mode 100644 index 000000000..6e06e9fa3 --- /dev/null +++ b/ext/standard/tests/streams/bug60455_02.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #60455: stream_get_line and 1-line followed by eol input +--FILE-- +<?php +class TestStream { + private $s = 0; + function stream_open($path, $mode, $options, &$opened_path) { + return true; + } + function stream_read($count) { + if ($this->s++ == 0) + return "a\n"; + + return ""; + } + function stream_eof() { + return $this->s >= 2; + } + +} + +stream_wrapper_register("test", "TestStream"); + +$f = fopen("test://", "r"); +while (!feof($f)) { + $line = stream_get_line($f, 99, "\n"); + var_dump($line); +} +--EXPECT-- +string(1) "a" diff --git a/ext/standard/tests/streams/bug60455_03.phpt b/ext/standard/tests/streams/bug60455_03.phpt new file mode 100644 index 000000000..5d7ba1f24 --- /dev/null +++ b/ext/standard/tests/streams/bug60455_03.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #60455: stream_get_line and 2 lines, one possibly empty +--FILE-- +<?php +class TestStream { + private $lines = array(); + private $s = 0; + private $eofth = 3; + function stream_open($path, $mode, $options, &$opened_path) { + $this->lines[] = "a\n"; + $this->lines[] = ($path == "test://nonempty2nd" ? "b\n" : "\n"); + if ($path == "test://eofafter2nd") + $this->eofth = 2; + return true; + } + function stream_read($count) { + if (key_exists($this->s++, $this->lines)) + return $this->lines[$this->s - 1]; + + return ""; + } + function stream_eof() { + return $this->s >= $this->eofth; + } + +} + +stream_wrapper_register("test", "TestStream"); + +$f = fopen("test://nonempty2nd", "r"); +while (!feof($f)) { + $line = stream_get_line($f, 99, "\n"); + var_dump($line); +} +$f = fopen("test://", "r"); +while (!feof($f)) { + $line = stream_get_line($f, 99, "\n"); + var_dump($line); +} +$f = fopen("test://eofafter2nd", "r"); +while (!feof($f)) { + $line = stream_get_line($f, 99, "\n"); + var_dump($line); +} + + +--EXPECT-- +string(1) "a" +string(1) "b" +string(1) "a" +string(0) "" +string(1) "a" +string(0) "" diff --git a/ext/standard/tests/streams/stream_context_set_option_basic.phpt b/ext/standard/tests/streams/stream_context_set_option_basic.phpt new file mode 100644 index 000000000..63730ee99 --- /dev/null +++ b/ext/standard/tests/streams/stream_context_set_option_basic.phpt @@ -0,0 +1,37 @@ +--TEST-- +stream_context_set_option() function - basic test for stream_context_set_option() +--CREDITS-- +Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr> +# Alter Way Contribution Day 2011 +--FILE-- +<?php +$context = stream_context_create(); + +// Single option +var_dump(stream_context_set_option($context, 'http', 'method', 'POST')); + +// Array of options +$options = array( + 'http' => array( + 'protocol_version' => 1.1, + 'user_agent' => 'PHPT Agent', + ), +); +var_dump(stream_context_set_option($context, $options)); + +var_dump(stream_context_get_options($context)); +?> +--EXPECT-- +bool(true) +bool(true) +array(1) { + ["http"]=> + array(3) { + ["method"]=> + string(4) "POST" + ["protocol_version"]=> + float(1.1) + ["user_agent"]=> + string(10) "PHPT Agent" + } +} diff --git a/ext/standard/tests/streams/stream_context_set_option_error_001.phpt b/ext/standard/tests/streams/stream_context_set_option_error_001.phpt new file mode 100644 index 000000000..04b37ca11 --- /dev/null +++ b/ext/standard/tests/streams/stream_context_set_option_error_001.phpt @@ -0,0 +1,21 @@ +--TEST-- +stream_context_set_option() function - error : invalid argument +--CREDITS-- +Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr> +# Alter Way Contribution Day 2011 +--FILE-- +<?php +$context = stream_context_create(); + +// Single option +var_dump(stream_context_set_option($context, 'http')); + +// Array of options +var_dump(stream_context_set_option($context, array(), 'foo', 'bar')); +?> +--EXPECTF-- +Warning: stream_context_set_option(): called with wrong number or type of parameters; please RTM in %s on line %d +bool(false) + +Warning: stream_context_set_option(): called with wrong number or type of parameters; please RTM in %s on line %d +bool(false) diff --git a/ext/standard/tests/streams/stream_context_set_option_error_002.phpt b/ext/standard/tests/streams/stream_context_set_option_error_002.phpt new file mode 100644 index 000000000..e80fd39ed --- /dev/null +++ b/ext/standard/tests/streams/stream_context_set_option_error_002.phpt @@ -0,0 +1,18 @@ +--TEST-- +stream_context_set_option() function - error : missing argument +--CREDITS-- +Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr> +# Alter Way Contribution Day 2011 +--FILE-- +<?php +var_dump(stream_context_set_option()); + +$context = stream_context_create(); +var_dump(stream_context_set_option($context)); +?> +--EXPECTF-- +Warning: stream_context_set_option(): called with wrong number or type of parameters; please RTM in %s on line %d +bool(false) + +Warning: stream_context_set_option(): called with wrong number or type of parameters; please RTM in %s on line %d +bool(false) diff --git a/ext/standard/tests/strings/bug55674.phpt b/ext/standard/tests/strings/bug55674.phpt new file mode 100644 index 000000000..72ece642a --- /dev/null +++ b/ext/standard/tests/strings/bug55674.phpt @@ -0,0 +1,50 @@ +--TEST-- +Bug #55674 (fgetcsv & str_getcsv skip empty fields in some tab-separated records) +--FILE-- +<?php +var_dump(str_getcsv("0\t\t\"2\"\n", "\t")); +var_dump(str_getcsv("0\t \t'2'\n", "\t", "'")); +var_dump(str_getcsv(",,,,")); +var_dump(str_getcsv(" \t \t\t\t ", "\t")); +?> +--EXPECT-- +array(3) { + [0]=> + string(1) "0" + [1]=> + string(0) "" + [2]=> + string(1) "2" +} +array(3) { + [0]=> + string(1) "0" + [1]=> + string(1) " " + [2]=> + string(1) "2" +} +array(5) { + [0]=> + string(0) "" + [1]=> + string(0) "" + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(0) "" +} +array(5) { + [0]=> + string(1) " " + [1]=> + string(2) " " + [2]=> + string(0) "" + [3]=> + string(0) "" + [4]=> + string(1) " " +} diff --git a/ext/standard/tests/strings/htmlentities_html4.phpt b/ext/standard/tests/strings/htmlentities_html4.phpt index d7bff707f..22b0305ce 100644 --- a/ext/standard/tests/strings/htmlentities_html4.phpt +++ b/ext/standard/tests/strings/htmlentities_html4.phpt @@ -1,9 +1,5 @@ --TEST-- htmlentities() conformance check (HTML 4) ---SKIPIF-- -<?php -if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); -?> --FILE-- <?php function utf32_utf8($k) { @@ -43,15 +39,23 @@ function utf32_utf8($k) { return $retval; } -for ($i = 0; $i < 0x110000; $i++) { +$table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, 'UTF-8'); + +for ($i = 0; $i < 0x2710; $i++) { if ($i >= 0xd800 && $i < 0xe000) continue; $str = utf32_utf8($i); - $result = htmlentities($str, ENT_QUOTES, 'UTF-8'); - if ($str != $result) { - printf("%s\tU+%05X\n", $result, $i); - } + if (isset($table[$str])) { + printf("%s\tU+%05X\n", $table[$str], $i); + unset($table[$str]); + } } + +if (!empty($table)) { + echo "Not matched entities: "; + var_dump($table); +} + ?> --EXPECT-- " U+00022 diff --git a/ext/standard/tests/strings/md5_file.phpt b/ext/standard/tests/strings/md5_file.phpt Binary files differindex 879cd59aa..e5d015cdd 100644 --- a/ext/standard/tests/strings/md5_file.phpt +++ b/ext/standard/tests/strings/md5_file.phpt diff --git a/ext/standard/tests/strings/sha1_file.phpt b/ext/standard/tests/strings/sha1_file.phpt index 3013adc34..574d384c2 100644 --- a/ext/standard/tests/strings/sha1_file.phpt +++ b/ext/standard/tests/strings/sha1_file.phpt @@ -1,17 +1,5 @@ --TEST-- Test sha1_file() function with ASCII output and raw binary output. Based on ext/standard/tests/strings/md5_file.phpt ---SKIPIF-- -<?php - -$path = dirname(__FILE__); -$data_file = "$path/EmptyFile.txt"; -$data_file1 = "$path/DataFile.txt"; -if !(($fp = fopen($data_file, 'w')) || ($fp1 = fopen($data_file1, 'w')) { - echo "File could not be created ,hence exiting from testcase due to pre-requisite failure\n"; -} -fclose( $fp ); -fclose( $fp1 ); - --FILE-- <?php diff --git a/ext/standard/tests/strings/substr_replace_array.phpt b/ext/standard/tests/strings/substr_replace_array.phpt new file mode 100644 index 000000000..dbb8b1714 --- /dev/null +++ b/ext/standard/tests/strings/substr_replace_array.phpt @@ -0,0 +1,19 @@ +--TEST-- +substr_replace() function - array +--FILE-- +<?php + +$arr = array('abc' => 'llsskdkk','def' => 'llsskjkkdd', 4 => 'hello', 42 => 'world'); +$newarr = substr_replace($arr, 'zzz', 0, -2); + +print_r($newarr); + +?> +--EXPECTF-- +Array +( + [abc] => zzzkk + [def] => zzzdd + [4] => zzzlo + [42] => zzzld +) diff --git a/ext/standard/tests/url/bug55273.phpt b/ext/standard/tests/url/bug55273.phpt new file mode 100644 index 000000000..1408506b4 --- /dev/null +++ b/ext/standard/tests/url/bug55273.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #55273 (base64_decode() with strict rejects whitespace after pad) +--FILE-- +<?php +function test($s) { + $v = chunk_split(base64_encode($s)); + $r = base64_decode($v, True); + var_dump($v, $r); +} + +test('PHP'); +test('PH'); +test('P'); + +?> +--EXPECT-- +string(6) "UEhQ +" +string(3) "PHP" +string(6) "UEg= +" +string(2) "PH" +string(6) "UA== +" +string(1) "P" |
