diff options
Diffstat (limited to 'ext/standard/tests/general_functions')
159 files changed, 1119 insertions, 2331 deletions
diff --git a/ext/standard/tests/general_functions/001.phpt b/ext/standard/tests/general_functions/001.phpt index 307122e1cb..a43215c2c7 100644 --- a/ext/standard/tests/general_functions/001.phpt +++ b/ext/standard/tests/general_functions/001.phpt @@ -7,41 +7,41 @@ $agent = sprintf("%.5s", "James Bond, 007"); echo("sprintf string truncate test: "); if ($agent == "James") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo("sprintf padding and align test: "); $test = sprintf("abc%04d %-20s%c", 20, "fisketur", 33); if ($test == "abc0020 fisketur !") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo("sprintf octal and hex test: "); $test = sprintf("%4o %4x %4X %0"."8x", 128, 1024, 49151, 3457925); if ($test == " 200 400 BFFF 0034c385") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo("sprintf octal binary test: "); $test = sprintf("%b", 3457925); if ($test == "1101001100001110000101") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo("sprintf float test: "); $test = sprintf("%0"."06.2f", 10000/3.0); if ($test == "003333.33") { - echo("passed\n"); + echo("passed\n"); } else { - echo("failed!\n"); + echo("failed!\n"); } echo sprintf("%.2f\n", "99.00"); diff --git a/ext/standard/tests/general_functions/002.phpt b/ext/standard/tests/general_functions/002.phpt index 58528da13a..43c67ec07b 100644 --- a/ext/standard/tests/general_functions/002.phpt +++ b/ext/standard/tests/general_functions/002.phpt @@ -1,9 +1,9 @@ --TEST-- quoted_printable_decode() function test --FILE-- -<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A= -=20=D4=cf=D2=C7=CF=D7=D9=C5= -=20= +<?php echo quoted_printable_decode("=FAwow-factor=C1=d0=D5=DD=C5=CE=CE=D9=C5=0A= +=20=D4=cf=D2=C7=CF=D7=D9=C5= +=20= =D0= =D2=CF=C5=CB=D4=D9"); ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/003.phpt b/ext/standard/tests/general_functions/003.phpt index 0388cf95b0..573491b8a2 100644 --- a/ext/standard/tests/general_functions/003.phpt +++ b/ext/standard/tests/general_functions/003.phpt @@ -6,18 +6,18 @@ levenshtein() function test function test_me($title,$expect,$text1,$text2,$cost1=0,$cost2=0,$cost3=0) { if($cost1==0) - $result=levenshtein($text1,$text2); - else + $result=levenshtein($text1,$text2); + else $result=levenshtein($text1,$text2,$cost1,$cost2,$cost3); - if($result==$expect) return 0; + if($result==$expect) return 0; - echo "$title: result is $result instead of $expect "; - echo "for '$text1'/'$text2' "; - if($cost1) echo "($cost1:$cost2:$cost3)"; - echo "\n"; + echo "$title: result is $result instead of $expect "; + echo "for '$text1'/'$text2' "; + if($cost1) echo "($cost1:$cost2:$cost3)"; + echo "\n"; - return 1; + return 1; } $n=0; diff --git a/ext/standard/tests/general_functions/004.phpt b/ext/standard/tests/general_functions/004.phpt index fa83c7c220..80a7216939 100644 --- a/ext/standard/tests/general_functions/004.phpt +++ b/ext/standard/tests/general_functions/004.phpt @@ -5,7 +5,7 @@ fgetcsv() with tab delimited fields (BUG #8258) chdir(__DIR__); $fp=fopen("004.data","r"); while($a=fgetcsv($fp,100,"\t")) { - echo join(",",$a)."\n"; + echo join(",",$a)."\n"; } fclose($fp); ?> diff --git a/ext/standard/tests/general_functions/006.phpt b/ext/standard/tests/general_functions/006.phpt index 6852286c5e..80a8fd4168 100644 --- a/ext/standard/tests/general_functions/006.phpt +++ b/ext/standard/tests/general_functions/006.phpt @@ -1,9 +1,9 @@ --TEST-- quoted_printable_decode() function test with CR/LF --FILE-- -<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A= -=20=D4=CF=D2=C7=CF=D7=D9=C5= -=20= +<?php echo quoted_printable_decode("=FAwow-factor=C1=D0=D5=DD=C5=CE=CE=D9=C5=0A= +=20=D4=CF=D2=C7=CF=D7=D9=C5= +=20= =D0= =D2=CF=C5=CB=D4=D9"); ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/007.phpt b/ext/standard/tests/general_functions/007.phpt index 02fc6c6480..e5775bb742 100644 --- a/ext/standard/tests/general_functions/007.phpt +++ b/ext/standard/tests/general_functions/007.phpt @@ -3,8 +3,8 @@ MD5 / Base64 --FILE-- <?php function test($str) { - $res = md5(base64_decode(base64_encode($str)))."\n"; - return $res; + $res = md5(base64_decode(base64_encode($str)))."\n"; + return $res; } echo test(""); echo test("a"); diff --git a/ext/standard/tests/general_functions/008.phpt b/ext/standard/tests/general_functions/008.phpt index 1148f777f4..45ffacbffe 100644 --- a/ext/standard/tests/general_functions/008.phpt +++ b/ext/standard/tests/general_functions/008.phpt @@ -34,7 +34,7 @@ array(14) { [11]=> float(123456789012) [12]=> - float(1.23456789012E+12) + float(1234567890123) [13]=> - float(1.23456789012E+19) + float(1.2345678901234567E+19) } diff --git a/ext/standard/tests/general_functions/009.phpt b/ext/standard/tests/general_functions/009.phpt index 39dc2189b3..254572f612 100644 --- a/ext/standard/tests/general_functions/009.phpt +++ b/ext/standard/tests/general_functions/009.phpt @@ -3,8 +3,8 @@ SHA1 --FILE-- <?php function test($str) { - $res = sha1($str)."\n"; - return $res; + $res = sha1($str)."\n"; + return $res; } echo test(""); echo test("a"); diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt index 51132c6a15..99971616d2 100644 --- a/ext/standard/tests/general_functions/010.phpt +++ b/ext/standard/tests/general_functions/010.phpt @@ -3,24 +3,19 @@ register_shutdown_function() & __call --FILE-- <?php class test { - function _foo() { - throw new Exception('test'); - } - function __call($name=null, $args=null) { - return test::_foo(); - } + function _foo() { + throw new Exception('test'); + } + function __call($name=null, $args=null) { + return test::_foo(); + } } -try { - var_dump(register_shutdown_function(array("test","__call"))); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; -} +var_dump(register_shutdown_function(array("test","__call"))); echo "Done\n"; ?> --EXPECTF-- -Exception: Non-static method test::__call() cannot be called statically +Warning: register_shutdown_function(): Invalid shutdown callback 'test::__call' passed in %s on line %d +bool(false) Done - -Fatal error: Non-static method test::__call() cannot be called statically in %s on line %d diff --git a/ext/standard/tests/general_functions/boolval.phpt b/ext/standard/tests/general_functions/boolval.phpt index 3c998520ff..fbe66264c3 100644 --- a/ext/standard/tests/general_functions/boolval.phpt +++ b/ext/standard/tests/general_functions/boolval.phpt @@ -2,18 +2,18 @@ Testing boolval() --FILE-- <?php - var_dump(boolval(false)); - var_dump(boolval(NULL)); - var_dump(boolval("")); - var_dump(boolval(0)); - var_dump(boolval(array())); + var_dump(boolval(false)); + var_dump(boolval(NULL)); + var_dump(boolval("")); + var_dump(boolval(0)); + var_dump(boolval(array())); - var_dump(boolval(true)); - var_dump(boolval("abc")); - var_dump(boolval(0.5)); - var_dump(boolval(100)); - var_dump(boolval(new stdClass())); - var_dump(boolval(STDIN)); + var_dump(boolval(true)); + var_dump(boolval("abc")); + var_dump(boolval(0.5)); + var_dump(boolval(100)); + var_dump(boolval(new stdClass())); + var_dump(boolval(STDIN)); ?> --EXPECT-- bool(false) diff --git a/ext/standard/tests/general_functions/bug25038.phpt b/ext/standard/tests/general_functions/bug25038.phpt index 52fe032056..58acf1c977 100644 --- a/ext/standard/tests/general_functions/bug25038.phpt +++ b/ext/standard/tests/general_functions/bug25038.phpt @@ -9,24 +9,22 @@ function bar($x='no argument') } try { - bar('first try'); + bar('first try'); } catch (Exception $e) { - print $e->getMessage()."\n"; + print $e->getMessage()."\n"; } try { - call_user_func('bar','second try'); + call_user_func('bar','second try'); } catch (Exception $e) { - print $e->getMessage()."\n"; + print $e->getMessage()."\n"; } ?> -===DONE=== --EXPECT-- This is an exception from bar(first try). This is an exception from bar(second try). -===DONE=== diff --git a/ext/standard/tests/general_functions/bug29038.phpt b/ext/standard/tests/general_functions/bug29038.phpt index d0c87fb199..5502ecf61a 100644 --- a/ext/standard/tests/general_functions/bug29038.phpt +++ b/ext/standard/tests/general_functions/bug29038.phpt @@ -3,8 +3,8 @@ Bug #29038 (extract(), EXTR_PREFIX_SAME option prefixes empty strings) --FILE-- <?php function my_print_r($a) { - ksort($a); - print_r($a); + ksort($a); + print_r($a); } function f1() { $c = extract(array("" => 1),EXTR_PREFIX_SAME,"prefix"); diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt index c6ff94833d..ff7bf9f056 100644 --- a/ext/standard/tests/general_functions/bug32647.phpt +++ b/ext/standard/tests/general_functions/bug32647.phpt @@ -10,8 +10,8 @@ function foo() class bar { - function barfoo () - { echo "bar!\n"; } + function barfoo () + { echo "bar!\n"; } } unset($obj); @@ -30,11 +30,11 @@ register_shutdown_function(array($obj,'barfoo')); // Valid ?> --EXPECTF-- -Notice: Undefined variable: obj in %s on line %d +Warning: Undefined variable $obj in %s on line %d Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d -Notice: Undefined variable: obj in %s on line %d +Warning: Undefined variable $obj in %s on line %d Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed in %s on line %d @@ -46,13 +46,8 @@ Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d -Deprecated: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d +Warning: register_shutdown_function(): Invalid shutdown callback 'bar::barfoo' passed in %sbug32647.php on line %d Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d foo! - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 -bar! bar! diff --git a/ext/standard/tests/general_functions/bug35229.phpt b/ext/standard/tests/general_functions/bug35229.phpt index 8e8895dd59..c0b3614f6e 100644 --- a/ext/standard/tests/general_functions/bug35229.phpt +++ b/ext/standard/tests/general_functions/bug35229.phpt @@ -9,9 +9,9 @@ class test2 { } spl_autoload_register(function ($class) { - eval('class test1 extends test2 {}'); + eval('class test1 extends test2 {}'); - test1::use_stack( + test1::use_stack( 1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30 diff --git a/ext/standard/tests/general_functions/bug36011.phpt b/ext/standard/tests/general_functions/bug36011.phpt index 00530bf846..3fe4e774b4 100644 --- a/ext/standard/tests/general_functions/bug36011.phpt +++ b/ext/standard/tests/general_functions/bug36011.phpt @@ -5,25 +5,25 @@ Bug #36011 (Strict errormsg wrong for call_user_func() and the likes) class TestClass { - static function test() - { - echo __METHOD__ . "()\n"; - } - - function whee() - { - array_map(array('TestClass', 'test'), array('array_value')); - } - - function whee4() - { - call_user_func(array('TestClass', 'test')); - } - - static function whee5() - { - call_user_func(array('TestClass', 'test')); - } + static function test() + { + echo __METHOD__ . "()\n"; + } + + function whee() + { + array_map(array('TestClass', 'test'), array('array_value')); + } + + function whee4() + { + call_user_func(array('TestClass', 'test')); + } + + static function whee5() + { + call_user_func(array('TestClass', 'test')); + } } TestClass::test(); @@ -36,11 +36,9 @@ $a->whee5(); TestClass::whee5(); ?> -===DONE=== --EXPECT-- TestClass::test() TestClass::test() TestClass::test() TestClass::test() TestClass::test() -===DONE=== diff --git a/ext/standard/tests/general_functions/bug40398.phpt b/ext/standard/tests/general_functions/bug40398.phpt index e92be5bedc..274faf8308 100644 --- a/ext/standard/tests/general_functions/bug40398.phpt +++ b/ext/standard/tests/general_functions/bug40398.phpt @@ -5,64 +5,64 @@ Bug #40398 (parent and self callback functions erroneously called statically) class Base { - function __construct($msg) - { - echo __METHOD__ . "($msg)\n"; - } + function __construct($msg) + { + echo __METHOD__ . "($msg)\n"; + } } class Derived_1 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array(array($this, 'Base::__construct'), $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array(array($this, 'Base::__construct'), $args); + } } class Derived_2 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array(array($this, 'parent::__construct'), $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array(array($this, 'parent::__construct'), $args); + } } class Derived_3 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array('Base::__construct', $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array('Base::__construct', $args); + } } class Derived_4 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array('parent::__construct', $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array('parent::__construct', $args); + } } class Derived_5 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array(array('Base', '__construct'), $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array(array('Base', '__construct'), $args); + } } class Derived_6 extends Base { - public function __construct() - { - $args = func_get_args(); - call_user_func_array(array('parent', '__construct'), $args); - } + public function __construct() + { + $args = func_get_args(); + call_user_func_array(array('parent', '__construct'), $args); + } } new Derived_1('1'); @@ -73,7 +73,6 @@ new Derived_5('5'); new Derived_6('6'); ?> -===DONE=== --EXPECT-- Base::__construct(1) Base::__construct(2) @@ -81,4 +80,3 @@ Base::__construct(3) Base::__construct(4) Base::__construct(5) Base::__construct(6) -===DONE=== diff --git a/ext/standard/tests/general_functions/bug41037.phpt b/ext/standard/tests/general_functions/bug41037.phpt index b9bb5856d8..c8d0a668d0 100644 --- a/ext/standard/tests/general_functions/bug41037.phpt +++ b/ext/standard/tests/general_functions/bug41037.phpt @@ -4,8 +4,8 @@ Bug #41037 (unregister_tick_function() inside the tick function crash PHP) <?php function a() { - echo "hello"; - unregister_tick_function('a'); + echo "hello"; + unregister_tick_function('a'); } declare (ticks=1) { diff --git a/ext/standard/tests/general_functions/bug41970.phpt b/ext/standard/tests/general_functions/bug41970.phpt index 6f05137afc..87401fdc67 100644 --- a/ext/standard/tests/general_functions/bug41970.phpt +++ b/ext/standard/tests/general_functions/bug41970.phpt @@ -6,22 +6,26 @@ Bug #41970 (call_user_func_*() leaks on failure) $a = array(4,3,2); var_dump(call_user_func_array("sort", array($a))); -var_dump(call_user_func_array("strlen", array($a))); +try { + var_dump(call_user_func_array("strlen", array($a))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(call_user_func("sort", $a)); -var_dump(call_user_func("strlen", $a)); +try { + var_dump(call_user_func("strlen", $a)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> --EXPECTF-- -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 5 +Warning: sort(): Argument #1 ($arg) must be passed by reference, value given in %s on line %d bool(true) +strlen(): Argument #1 ($str) must be of type string, array given -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 6 -NULL - -Warning: Parameter 1 to sort() expected to be a reference, value given in %sbug41970.php on line 7 +Warning: sort(): Argument #1 ($arg) must be passed by reference, value given in %s on line %d bool(true) - -Warning: strlen() expects parameter 1 to be string, array given in %sbug41970.php on line 8 -NULL +strlen(): Argument #1 ($str) must be of type string, array given Done diff --git a/ext/standard/tests/general_functions/bug44295.phpt b/ext/standard/tests/general_functions/bug44295.phpt index c9744e64dd..12cfb819a4 100644 --- a/ext/standard/tests/general_functions/bug44295.phpt +++ b/ext/standard/tests/general_functions/bug44295.phpt @@ -25,5 +25,5 @@ try { <?php exit(0); ?> --EXPECT-- before -in catch: DirectoryIterator::__construct(/this/path/does/not/exist): failed to open dir: No such file or directory +in catch: DirectoryIterator::__construct(/this/path/does/not/exist): Failed to open directory: No such file or directory ==DONE== diff --git a/ext/standard/tests/general_functions/bug44667.phpt b/ext/standard/tests/general_functions/bug44667.phpt index d4d7b94b4b..00c8224416 100644 --- a/ext/standard/tests/general_functions/bug44667.phpt +++ b/ext/standard/tests/general_functions/bug44667.phpt @@ -8,8 +8,8 @@ Bug #44667 (proc_open() does not handle pipes with the mode 'wb' correctly) $pipes = array(); $descriptor_spec = array( - 0 => array('pipe', 'rb'), - 1 => array('pipe', 'wb'), + 0 => array('pipe', 'rb'), + 1 => array('pipe', 'wb'), ); $proc = proc_open('cat', $descriptor_spec, $pipes); diff --git a/ext/standard/tests/general_functions/bug46587.phpt b/ext/standard/tests/general_functions/bug46587.phpt index becbde9648..d9b3044406 100644 --- a/ext/standard/tests/general_functions/bug46587.phpt +++ b/ext/standard/tests/general_functions/bug46587.phpt @@ -4,13 +4,15 @@ Bug #46587 (mt_rand() does not check that max is greater than min). <?php var_dump(mt_rand(3,8)); -var_dump(mt_rand(8,3)); +try { + var_dump(mt_rand(8,3)); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} echo "Done.\n"; ?> --EXPECTF-- int(%d) - -Warning: mt_rand(): max(3) is smaller than min(8) in %s on line %d -bool(false) +mt_rand(): Argument #2 ($max) must be greater than or equal to argument #1 ($min) Done. diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt index d19eca7248..0d2b35b09f 100644 --- a/ext/standard/tests/general_functions/bug47857.phpt +++ b/ext/standard/tests/general_functions/bug47857.phpt @@ -3,23 +3,25 @@ Bug #47851 (is_callable throws fatal error) --FILE-- <?php class foo { - function bar() { - echo "ok\n"; - } + function bar() { + echo "ok\n"; + } } var_dump(is_callable(array('foo','bar'))); -foo::bar(); +try { + foo::bar(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} var_dump(is_callable(array('Exception','getMessage'))); -Exception::getMessage(); +try { + Exception::getMessage(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -bool(true) - -Deprecated: Non-static method foo::bar() should not be called statically in %sbug47857.php on line %d -ok +--EXPECT-- +bool(false) +Non-static method foo::bar() cannot be called statically bool(false) - -Fatal error: Uncaught Error: Non-static method Exception::getMessage() cannot be called statically in %sbug47857.php:%d -Stack trace: -#0 {main} - thrown in %sbug47857.php on line %d +Non-static method Exception::getMessage() cannot be called statically diff --git a/ext/standard/tests/general_functions/bug49847.phpt b/ext/standard/tests/general_functions/bug49847.phpt index a35477d00c..1a09c364d8 100644 --- a/ext/standard/tests/general_functions/bug49847.phpt +++ b/ext/standard/tests/general_functions/bug49847.phpt @@ -5,17 +5,17 @@ Bug #49847 (exec() fails on lines larger then 4095 bytes) $iswin = substr(PHP_OS, 0, 3) == "WIN"; if ($iswin) { - $f = __DIR__ . '\\bug49847.tmp'; - $s = str_repeat(' ', 4097); - $s .= '1'; - file_put_contents($f, $s); - exec('type ' . $f, $output); + $f = __DIR__ . '\\bug49847.tmp'; + $s = str_repeat(' ', 4097); + $s .= '1'; + file_put_contents($f, $s); + exec('type ' . $f, $output); } else { - exec("printf %4098d 1", $output); + exec("printf %4098d 1", $output); } var_dump($output); if ($iswin) { - unlink($f); + unlink($f); } ?> --EXPECTF-- diff --git a/ext/standard/tests/general_functions/bug55371.phpt b/ext/standard/tests/general_functions/bug55371.phpt deleted file mode 100644 index 5b324db599..0000000000 --- a/ext/standard/tests/general_functions/bug55371.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Bug #55371 (get_magic_quotes_gpc() and get_magic_quotes_runtime() throw deprecated warning) ---FILE-- -<?php - -get_magic_quotes_gpc(); -get_magic_quotes_runtime(); - -echo 'done'; - -?> ---EXPECTF-- -Deprecated: Function get_magic_quotes_gpc() is deprecated in %s on line %d - -Deprecated: Function get_magic_quotes_runtime() is deprecated in %s on line %d -done diff --git a/ext/standard/tests/general_functions/bug60723.phpt b/ext/standard/tests/general_functions/bug60723.phpt index 504de7afbf..fff1b78790 100644 --- a/ext/standard/tests/general_functions/bug60723.phpt +++ b/ext/standard/tests/general_functions/bug60723.phpt @@ -14,6 +14,6 @@ readfile($log); unlink($log); ?> --EXPECTF-- -Notice: Undefined variable: aa in %sbug60723.php on line %d -[%s ASIA/Chongqing] PHP Notice: Undefined variable: aa in %sbug60723.php on line %d +Warning: Undefined variable $aa in %s on line %d +[%s ASIA/Chongqing] PHP Warning: Undefined variable $aa in %s on line %d [%s ASIA/Chongqing] dummy diff --git a/ext/standard/tests/general_functions/bug67498.phpt b/ext/standard/tests/general_functions/bug67498.phpt index 5b5951b0f8..dd1ef11ef5 100644 --- a/ext/standard/tests/general_functions/bug67498.phpt +++ b/ext/standard/tests/general_functions/bug67498.phpt @@ -6,10 +6,8 @@ $PHP_SELF = 1; phpinfo(INFO_VARIABLES); ?> -==DONE== --EXPECTF-- phpinfo() PHP Variables %A -==DONE== diff --git a/ext/standard/tests/general_functions/bug70018.phpt b/ext/standard/tests/general_functions/bug70018.phpt index f7aefcc03f..77df0417a6 100644 --- a/ext/standard/tests/general_functions/bug70018.phpt +++ b/ext/standard/tests/general_functions/bug70018.phpt @@ -1,11 +1,5 @@ --TEST-- Bug #70018 (exec does not strip all whitespace) ---SKIPIF-- -<?php -if ("cli" != php_sapi_name()) { - die("skip.. CLI only test"); -} -?> --FILE-- <?php $output = array(); diff --git a/ext/standard/tests/general_functions/bug71891.phpt b/ext/standard/tests/general_functions/bug71891.phpt index b1f7e200d8..4de58f2c29 100644 --- a/ext/standard/tests/general_functions/bug71891.phpt +++ b/ext/standard/tests/general_functions/bug71891.phpt @@ -4,10 +4,10 @@ Bug #71891 (header_register_callback() and register_shutdown_function()) <?php header_register_callback(function () { - echo 'header'; - register_shutdown_function(function () { - echo 'shutdown'; - }); + echo 'header'; + register_shutdown_function(function () { + echo 'shutdown'; + }); }); ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/bug72306.phpt b/ext/standard/tests/general_functions/bug72306.phpt index 05c25e6f1e..761a6454b3 100644 --- a/ext/standard/tests/general_functions/bug72306.phpt +++ b/ext/standard/tests/general_functions/bug72306.phpt @@ -3,8 +3,8 @@ Bug #72306 (Heap overflow through proc_open and $env parameter) --FILE-- <?php class moo { - function __construct() { $this->a = 0; } - function __toString() { return $this->a++ ? str_repeat("a", 0x8000) : "a"; } + function __construct() { $this->a = 0; } + function __toString() { return $this->a++ ? str_repeat("a", 0x8000) : "a"; } } $env = array('some_option' => new moo()); diff --git a/ext/standard/tests/general_functions/bug72920.phpt b/ext/standard/tests/general_functions/bug72920.phpt index 8ba4d26713..24a8724904 100644 --- a/ext/standard/tests/general_functions/bug72920.phpt +++ b/ext/standard/tests/general_functions/bug72920.phpt @@ -3,10 +3,14 @@ Bug #72920 (Accessing a private constant using constant() creates an exception A --FILE-- <?php class Foo { - private const C1 = "a"; + private const C1 = "a"; } -var_dump(constant('Foo::C1')); ---EXPECTF-- -Warning: constant(): Couldn't find constant Foo::C1 in %s on line %d -NULL +try { + var_dump(constant('Foo::C1')); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +?> +--EXPECT-- +Cannot access private const Foo::C1 diff --git a/ext/standard/tests/general_functions/bug76643.phpt b/ext/standard/tests/general_functions/bug76643.phpt index 47b5345860..07f789f464 100644 --- a/ext/standard/tests/general_functions/bug76643.phpt +++ b/ext/standard/tests/general_functions/bug76643.phpt @@ -6,7 +6,5 @@ $_SERVER = 'foo'; output_add_rewrite_var('bar', 'baz'); ?> <form action="http://example.com/"></form> -===DONE=== --EXPECT-- <form action="http://example.com/"></form> -===DONE=== diff --git a/ext/standard/tests/general_functions/bug78569.phpt b/ext/standard/tests/general_functions/bug78569.phpt index 70d8a995a2..afc0b6f877 100644 --- a/ext/standard/tests/general_functions/bug78569.phpt +++ b/ext/standard/tests/general_functions/bug78569.phpt @@ -4,8 +4,6 @@ Bug #78569 (proc_open() may require extra quoting) <?php if (PHP_OS_FAMILY !== 'Windows') die('skip this test is for Windows platforms only'); ?> ---XFAIL-- -Before PHP 8.0.0 we would need to add extra quotes. --FILE-- <?php // We are searching for the following line: diff --git a/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt index c05a329342..cd76dc79e3 100644 --- a/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt +++ b/ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt @@ -4,11 +4,11 @@ call_user_func_array() passes by reference if the array element is referenced, r <?php function by_val($arg) { - $arg = 'changed'; + $arg = 'changed'; } function by_ref(&$arg) { - $arg = 'changed'; + $arg = 'changed'; } echo "------ Calling by_val() with unreferenced argument ------\n"; @@ -42,7 +42,7 @@ array(1) { } ------ Calling by_ref() with unreferenced argument ------ -Warning: Parameter 1 to by_ref() expected to be a reference, value given in %s on line %d +Warning: by_ref(): Argument #1 ($arg) must be passed by reference, value given in %s on line %d array(1) { [0]=> string(8) "original" diff --git a/ext/standard/tests/general_functions/call_user_func_return.phpt b/ext/standard/tests/general_functions/call_user_func_return.phpt index cb0f6998dc..4719587ffc 100644 --- a/ext/standard/tests/general_functions/call_user_func_return.phpt +++ b/ext/standard/tests/general_functions/call_user_func_return.phpt @@ -7,31 +7,30 @@ $t1 = 'test1'; function test1($arg1, $arg2) { - global $t1; - echo "$arg1 $arg2\n"; - return $t1; + global $t1; + echo "$arg1 $arg2\n"; + return $t1; } $t2 = 'test2'; function & test2($arg1, $arg2) { - global $t2; - echo "$arg1 $arg2\n"; - return $t2; + global $t2; + echo "$arg1 $arg2\n"; + return $t2; } function test($func) { - debug_zval_dump($func('Direct', 'Call')); - debug_zval_dump(call_user_func_array($func, array('User', 'Func'))); + debug_zval_dump($func('Direct', 'Call')); + debug_zval_dump(call_user_func_array($func, array('User', 'Func'))); } test('test1'); test('test2'); ?> -===DONE=== --EXPECTF-- Direct Call string(5) "test1" refcount(%d) @@ -41,4 +40,3 @@ Direct Call string(5) "test2" refcount(%d) User Func string(5) "test2" refcount(%d) -===DONE=== diff --git a/ext/standard/tests/general_functions/callbacks_001.phpt b/ext/standard/tests/general_functions/callbacks_001.phpt index a58f19d932..67afab6345 100644 --- a/ext/standard/tests/general_functions/callbacks_001.phpt +++ b/ext/standard/tests/general_functions/callbacks_001.phpt @@ -69,7 +69,11 @@ class P extends O { $this->call(array('parent', 'who')); $this->call(array('P', 'parent::who')); $this->call(array($this, 'O::who')); - $this->call(array($this, 'B::who')); + try { + $this->call(array($this, 'B::who')); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } @@ -79,8 +83,7 @@ $o = new P; $o->test(); ?> -===DONE=== ---EXPECTF-- +--EXPECT-- parent|who B C|parent::who @@ -103,6 +106,4 @@ O $this|O::who O $this|B::who - -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'P' is not a subclass of 'B' in %s on line %d -===DONE=== +call_user_func(): Argument #1 ($function) must be a valid callback, class 'P' is not a subclass of 'B' diff --git a/ext/standard/tests/general_functions/callbacks_002.phpt b/ext/standard/tests/general_functions/callbacks_002.phpt index 22130c524a..f69a886ad3 100644 --- a/ext/standard/tests/general_functions/callbacks_002.phpt +++ b/ext/standard/tests/general_functions/callbacks_002.phpt @@ -3,14 +3,24 @@ call_user_func(): Wrong parameters --FILE-- <?php -call_user_func(array('Foo', 'bar')); -call_user_func(array(NULL, 'bar')); -call_user_func(array('stdclass', NULL)); +try { + call_user_func(array('Foo', 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array(NULL, 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array('stdclass', NULL)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Foo' not found in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, second array member is not a valid method in %s on line %d +--EXPECT-- +call_user_func(): Argument #1 ($function) must be a valid callback, class 'Foo' not found +call_user_func(): Argument #1 ($function) must be a valid callback, first array member is not a valid class name or object +call_user_func(): Argument #1 ($function) must be a valid callback, second array member is not a valid method 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 64352105db..ac4149f61c 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_o.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_o.phpt @@ -29,13 +29,13 @@ class object_class { public $value4 = 30; private function foo1() { - echo "function foo1\n"; + echo "function foo1\n"; } protected function foo2() { - echo "function foo2\n"; + echo "function foo2\n"; } public function foo3() { - echo "function foo3\n"; + echo "function foo3\n"; } public $array_var = array( "key1" => 1, "key2 " => 3); diff --git a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt index 6cb413dc26..b893d80246 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt @@ -85,7 +85,7 @@ debug_zval_dump($var_1); echo "\n-- Value of \$var_2: --\n"; debug_zval_dump($var_2); -echo "\n*** Testing debug_zval_dump() on miscelleneous input arguments ***\n"; +echo "\n*** Testing debug_zval_dump() on miscellaneous input arguments ***\n"; /* unset a variable */ $unset_var = 10.5; unset($unset_var); @@ -147,7 +147,7 @@ int(10) -- Value of $ref_first_var -- -Notice: Undefined variable: ref_first_var in %s on line %d +Warning: Undefined variable $ref_first_var in %s on line %d NULL -- Value of $first_var -- @@ -166,7 +166,7 @@ int(10) -- Value of $var_3: (after unsetting var_3) -- -Notice: Undefined variable: var_3 in %s on line %d +Warning: Undefined variable $var_3 in %s on line %d NULL -- Value of $var_2: -- @@ -177,13 +177,13 @@ int(10) -- Value of $var_1: (after unsetting variable_1) -- -Notice: Undefined variable: var_1 in %s on line %d +Warning: Undefined variable $var_1 in %s on line %d NULL -- Value of $var_2: -- int(10) -*** Testing debug_zval_dump() on miscelleneous input arguments *** +*** Testing debug_zval_dump() on miscellaneous input arguments *** -- Iteration 1 -- NULL -- Iteration 2 -- diff --git a/ext/standard/tests/general_functions/error_clear_last.phpt b/ext/standard/tests/general_functions/error_clear_last.phpt index 675affb625..88a59d949a 100644 --- a/ext/standard/tests/general_functions/error_clear_last.phpt +++ b/ext/standard/tests/general_functions/error_clear_last.phpt @@ -20,9 +20,9 @@ NULL NULL array(4) { ["type"]=> - int(8) + int(2) ["message"]=> - string(21) "Undefined variable: b" + string(21) "Undefined variable $b" ["file"]=> string(%d) "%s" ["line"]=> diff --git a/ext/standard/tests/general_functions/error_get_last.phpt b/ext/standard/tests/general_functions/error_get_last.phpt index 71f068f104..9bdefc334b 100644 --- a/ext/standard/tests/general_functions/error_get_last.phpt +++ b/ext/standard/tests/general_functions/error_get_last.phpt @@ -4,7 +4,11 @@ error_get_last() tests <?php var_dump(error_get_last()); -var_dump(error_get_last(true)); +try { + var_dump(error_get_last(true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(error_get_last()); $a = $b; @@ -15,29 +19,18 @@ echo "Done\n"; ?> --EXPECTF-- NULL - -Warning: error_get_last() expects exactly 0 parameters, 1 given in %s on line %d +error_get_last() expects exactly 0 parameters, 1 given NULL -array(4) { - ["type"]=> - int(2) - ["message"]=> - string(54) "error_get_last() expects exactly 0 parameters, 1 given" - ["file"]=> - string(%i) "%s" - ["line"]=> - int(4) -} -Notice: Undefined variable: b in %s on line %d +Warning: Undefined variable $b in %s on line %d array(4) { ["type"]=> - int(8) + int(2) ["message"]=> - string(21) "Undefined variable: b" + string(21) "Undefined variable $b" ["file"]=> - string(%i) "%s" + string(%d) "%s" ["line"]=> - int(7) + int(11) } Done diff --git a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt index cbb3f6fcc4..ac85410593 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_bug71039.phpt @@ -7,4 +7,8 @@ escapeshellarg("hello\0world"); ?> ===DONE=== --EXPECTF-- -Fatal error: escapeshellarg(): Input string contains NULL bytes in %s on line %d +Fatal error: Uncaught TypeError: escapeshellarg(): Argument #1 ($arg) must not contain any null bytes in %s:%d +Stack trace: +#0 %s(%d): escapeshellarg('hello\x00world') +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt index aa264cce37..309eca316e 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_variation1-win32.phpt @@ -69,12 +69,11 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of escapeshellarg() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(escapeshellarg($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(escapeshellarg($input)); + $iterator++; }; ?> -===Done=== --EXPECT-- *** Testing escapeshellarg() : usage variations *** @@ -137,4 +136,3 @@ string(2) """" -- Iteration 20 -- string(2) """" -===Done=== diff --git a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt index 6f3b6a9f32..e2aec56c27 100644 --- a/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt +++ b/ext/standard/tests/general_functions/escapeshellarg_variation1.phpt @@ -69,12 +69,11 @@ $inputs = array( // loop through each element of $inputs to check the behaviour of escapeshellarg() $iterator = 1; foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(escapeshellarg($input)); - $iterator++; + echo "\n-- Iteration $iterator --\n"; + var_dump(escapeshellarg($input)); + $iterator++; }; ?> -===Done=== --EXPECT-- *** Testing escapeshellarg() : usage variations *** @@ -137,4 +136,3 @@ string(2) "''" -- Iteration 20 -- string(2) "''" -===Done=== diff --git a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt index 5254e5d57a..3f014fdf81 100644 --- a/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt +++ b/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt @@ -10,21 +10,21 @@ if( substr(PHP_OS, 0, 3) != 'WIN' ) { <?php echo "*** Testing escapeshellcmd() basic operations ***\n"; $data = array( - '"abc', - "'abc", - '?<>', - '()[]{}$', - '%^', - '#&;`|*?', - '~<>\\', - '%NOENV%', - '!NOENV!' + '"abc', + "'abc", + '?<>', + '()[]{}$', + '%^', + '#&;`|*?', + '~<>\\', + '%NOENV%', + '!NOENV!' ); $count = 1; foreach ($data AS $value) { - echo "-- Test " . $count++ . " --\n"; - var_dump(escapeshellcmd($value)); + echo "-- Test " . $count++ . " --\n"; + var_dump(escapeshellcmd($value)); } echo "Done\n"; diff --git a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt index 0a4d7eacff..acb337f556 100644 --- a/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt +++ b/ext/standard/tests/general_functions/escapeshellcmd_bug71039.phpt @@ -7,4 +7,8 @@ escapeshellcmd("hello\0world"); ?> ===DONE=== --EXPECTF-- -Fatal error: escapeshellcmd(): Input string contains NULL bytes in %s on line %d +Fatal error: Uncaught TypeError: escapeshellcmd(): Argument #1 ($command) must not contain any null bytes in %s:%d +Stack trace: +#0 %s(%d): escapeshellcmd('hello\x00world') +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/general_functions/floatval.phpt b/ext/standard/tests/general_functions/floatval.phpt index a01e01dbf1..a409f92a75 100644 --- a/ext/standard/tests/general_functions/floatval.phpt +++ b/ext/standard/tests/general_functions/floatval.phpt @@ -13,23 +13,23 @@ $valid_floats = array( 1.0, -1.0, 1.234, - -1.234, + -1.234, 1.2e3, - -1.2e3, - 10.0000000000000000005, - 10.5e+5, + -1.2e3, + 10.0000000000000000005, + 10.5e+5, 1e5, - -1e5, + -1e5, 1e-5, - -1e-1, - 1e+5, - -1e+5, - 1E5, - -1E5, - 1E+5, - -1E+5, - .5e+7, - -.5e+7 + -1e-1, + 1e+5, + -1e+5, + 1E5, + -1E5, + 1E+5, + -1E+5, + .5e+7, + -.5e+7 ); /* loop to check that floatval() recognizes different @@ -65,12 +65,12 @@ $not_float_types = array ( $dfp, "0.0", // string "1.0", - "-1.3e3", - "bob-1.3e3", + "-1.3e3", + "bob-1.3e3", "10 Some dollars", - "10.2 Some Dollars", - "10.0 dollar" + 1, - "10.0 dollar" + 1.0, + "10.2 Some Dollars", + "10.0 dollar" + 1, + "10.0 dollar" + 1.0, "", true, NULL, @@ -91,18 +91,6 @@ foreach ($not_float_types as $type ) { var_dump( doubleval($type) ); } - - - -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( floatval() ); -var_dump( doubleval() ); - -//arguments more than expected -var_dump( floatval(TRUE, FALSE) ); -var_dump( doubleval(TRUE, FALSE) ); - echo "\nDone\n"; @@ -194,18 +182,4 @@ float(1) float(0) float(0) -*** Testing error conditions *** - -Warning: floatval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: floatval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: doubleval() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/general_functions/floatval_basic.phpt b/ext/standard/tests/general_functions/floatval_basic.phpt index 8ad628b4f0..d6a3b72a19 100644 --- a/ext/standard/tests/general_functions/floatval_basic.phpt +++ b/ext/standard/tests/general_functions/floatval_basic.phpt @@ -14,23 +14,23 @@ $valid_floats = array( "1.0" => 1.0, "-1.0" => -1.0, "1.234" => 1.234, - "-1.234" => -1.234, + "-1.234" => -1.234, "1.2e3" => 1.2e3, - "-1.2e3" => -1.2e3, - "10.0000000000000000005" => 10.0000000000000000005, - "10.5e+5" => 10.5e+5, + "-1.2e3" => -1.2e3, + "10.0000000000000000005" => 10.0000000000000000005, + "10.5e+5" => 10.5e+5, "1e5" => 1e5, - "-1e5" => -1e5, + "-1e5" => -1e5, "1e5" => 1e-5, - "-1e-1" => -1e-1, - "1e+5" => 1e+5, - "-1e+5" =>-1e+5, - "1E5" => 1E5, - "-1E5" => -1E5, - "1E+5" => 1E+5, - "-1E5" => -1E+5, - ".5e+7" => .5e+7, - "-.5e+7" =>-.5e+7 + "-1e-1" => -1e-1, + "1e+5" => 1e+5, + "-1e+5" =>-1e+5, + "1E5" => 1E5, + "-1E5" => -1E5, + "1E+5" => 1E+5, + "-1E5" => -1E+5, + ".5e+7" => .5e+7, + "-.5e+7" =>-.5e+7 ); /* loop to check that floatval() recognizes different @@ -50,7 +50,6 @@ foreach ($valid_floats as $key => $value ) { } ?> -===DONE=== --EXPECT-- *** Testing floatval() with valid float values *** @@ -169,4 +168,3 @@ float(5000000) -- Iteration : -.5e+7 -- float(-5000000) -===DONE=== diff --git a/ext/standard/tests/general_functions/floatval_variation1.phpt b/ext/standard/tests/general_functions/floatval_variation1.phpt index 2b49cd195b..e688253e3f 100644 --- a/ext/standard/tests/general_functions/floatval_variation1.phpt +++ b/ext/standard/tests/general_functions/floatval_variation1.phpt @@ -22,12 +22,12 @@ $not_float_types = array ( "directory resource" => $dfp, "\"0.0\"" => "0.0", // string "\"1.0\"" => "1.0", - "\"-1.3e3\"" => "-1.3e3", - "\"bob-1.3e3\"" => "bob-1.3e3", + "\"-1.3e3\"" => "-1.3e3", + "\"bob-1.3e3\"" => "bob-1.3e3", "\"10 Some dollars\"" => "10 Some dollars", - "\"10.2 Some Dollars\"" => "10.2 Some Dollars", - "\"10.0 dollar\" + 1" => "10.0 dollar" + 1, - "\"10.0 dollar\" + 1.0" => "10.0 dollar" + 1.0, + "\"10.2 Some Dollars\"" => "10.2 Some Dollars", + "\"10.0 dollar\" + 1" => "10.0 dollar" + 1, + "\"10.0 dollar\" + 1.0" => "10.0 dollar" + 1.0, "\"\"" => "", "true" => true, "NULL" => NULL, @@ -50,7 +50,6 @@ foreach ($not_float_types as $key => $type ) { var_dump( doubleval($type) ); } ?> -===DONE=== --EXPECTF-- Notice: A non well formed numeric value encountered in %s on line %d @@ -155,4 +154,3 @@ float(0) -- Iteration : null -- float(0) -===DONE=== diff --git a/ext/standard/tests/general_functions/get_debug_type_basic.phpt b/ext/standard/tests/general_functions/get_debug_type_basic.phpt new file mode 100644 index 0000000000..35fc808517 --- /dev/null +++ b/ext/standard/tests/general_functions/get_debug_type_basic.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test get_debug_type() class reading +--FILE-- +<?php + +namespace Demo { + class ClassInNamespace { + + } +} + +namespace { + class ClassInGlobal { } + + class ToBeExtended { } + interface ToBeImplemented { } + + $fp = fopen(__FILE__, 'r'); + + $fp_closed = fopen(__FILE__, 'r'); + fclose($fp_closed); + + /* tests against an object type */ + echo get_debug_type(new ClassInGlobal()) . "\n"; + echo get_debug_type(new Demo\ClassInNamespace()) . "\n"; + echo get_debug_type(new class {}) . "\n"; + echo get_debug_type(new class extends ToBeExtended {}) . "\n"; + echo get_debug_type(new class implements ToBeImplemented {}) . "\n"; + + /* scalars */ + echo get_debug_type("foo") . "\n"; + echo get_debug_type(false) . "\n"; + echo get_debug_type(true) . "\n"; + echo get_debug_type(1) . "\n"; + echo get_debug_type(1.1) . "\n"; + echo get_debug_type([]) . "\n"; + echo get_debug_type(null) . "\n"; + echo get_debug_type($fp) . "\n"; + echo get_debug_type($fp_closed) . "\n"; + +} + +--EXPECT-- +ClassInGlobal +Demo\ClassInNamespace +class@anonymous +ToBeExtended@anonymous +ToBeImplemented@anonymous +string +bool +bool +int +float +array +null +resource (stream) +resource (closed) diff --git a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt index 1d9ca4a277..7876540e8a 100644 --- a/ext/standard/tests/general_functions/get_defined_constants_basic.phpt +++ b/ext/standard/tests/general_functions/get_defined_constants_basic.phpt @@ -22,13 +22,12 @@ $arr2 = get_defined_constants(); $n2 = count($arr2); if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } else { - echo "TEST FAILED\n"; + echo "TEST FAILED\n"; } ?> -===DONE=== --EXPECT-- *** Testing get_defined_constants() : basic functionality *** string(5) "array" @@ -36,4 +35,3 @@ string(5) "array" array(0) { } TEST PASSED -===DONE=== diff --git a/ext/standard/tests/general_functions/get_defined_vars_basic.phpt b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt index 6e9494509a..19b59fea96 100644 --- a/ext/standard/tests/general_functions/get_defined_vars_basic.phpt +++ b/ext/standard/tests/general_functions/get_defined_vars_basic.phpt @@ -15,7 +15,7 @@ function f1() { $vars = get_defined_vars(); if (count($vars) != 0) { - echo "TEST FAILED\n"; + echo "TEST FAILED\n"; } echo "\n-- ..define some local variables --\n"; @@ -33,7 +33,7 @@ function f2() { $vars= get_defined_vars(); if (count($vars) != 0) { - echo "TEST FAILED\n"; + echo "TEST FAILED\n"; } echo "\n-- ...define some variables --\n"; @@ -63,7 +63,6 @@ if (count($vars) == 0) { f1(); ?> -===DONE=== --EXPECT-- Simple testcase for get_defined_vars() function @@ -149,4 +148,3 @@ array(9) { ["b1"]=> bool(true) } -===DONE=== diff --git a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt index 33d4af03d2..cb4b84c99d 100644 --- a/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt +++ b/ext/standard/tests/general_functions/get_extension_funcs_basic.phpt @@ -14,10 +14,12 @@ $result = get_extension_funcs("standard"); var_dump(gettype($result)); var_dump(in_array("cos", $result)); +// Unknown extension +var_dump(get_extension_funcs("foo")); + ?> -===DONE=== --EXPECT-- Simple testcase for get_extension_funcs() function string(5) "array" bool(true) -===DONE=== +bool(false) diff --git a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt b/ext/standard/tests/general_functions/get_extension_funcs_error.phpt deleted file mode 100644 index 44bd822d12..0000000000 --- a/ext/standard/tests/general_functions/get_extension_funcs_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test get_extension_funcs() function : error conditions ---FILE-- -<?php -/* Prototype : array get_extension_funcs ( string $module_name ) - * Description: Returns an array with the names of the functions of a module. - * Source code: Zend/zend_builtin_functions.c - * Alias to functions: - */ - -echo "*** Testing get_extension_funcs() : error conditions ***\n"; - -echo "\n-- Too few arguments --\n"; -var_dump(get_extension_funcs()); - -$extra_arg = 1; -echo "\n-- Too many arguments --\n"; -var_dump(get_extension_funcs("standard", $extra_arg)); - -echo "\n-- Invalid extension name --\n"; -var_dump(get_extension_funcs("foo")); - -?> -===DONE=== ---EXPECTF-- -*** Testing get_extension_funcs() : error conditions *** - --- Too few arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Too many arguments -- - -Warning: get_extension_funcs() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Invalid extension name -- -bool(false) -===DONE=== diff --git a/ext/standard/tests/general_functions/get_include_path_basic.phpt b/ext/standard/tests/general_functions/get_include_path_basic.phpt index 2017bf697a..c17d5d3e71 100644 --- a/ext/standard/tests/general_functions/get_include_path_basic.phpt +++ b/ext/standard/tests/general_functions/get_include_path_basic.phpt @@ -14,24 +14,13 @@ echo "*** Testing get_include_path()\n"; var_dump(get_include_path()); if (ini_get("include_path") == get_include_path()) { - echo "PASSED\n"; + echo "PASSED\n"; } else { - echo "FAILED\n"; + echo "FAILED\n"; } -echo "\nError cases:\n"; -var_dump(get_include_path(TRUE)); - - ?> -===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing get_include_path() string(1) "." PASSED - -Error cases: - -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/general_functions/get_included_files.phpt b/ext/standard/tests/general_functions/get_included_files.phpt index df41ec8513..d81c72e3ea 100644 --- a/ext/standard/tests/general_functions/get_included_files.phpt +++ b/ext/standard/tests/general_functions/get_included_files.phpt @@ -22,11 +22,7 @@ include(__DIR__."/get_included_files_inc2.inc"); echo "\n-- List included files atfter including inc2 which will include inc3 which includes inc1 --\n"; var_dump(get_included_files()); -echo "\n-- Error cases --\n"; -var_dump(get_included_files(true)); - ?> -===DONE=== --EXPECTF-- *** Testing get_included_files() @@ -55,9 +51,3 @@ array(4) { [3]=> string(%d) "%sget_included_files_inc3.inc" } - --- Error cases -- - -Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt index c72a88de13..3be43caecb 100644 --- a/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt +++ b/ext/standard/tests/general_functions/get_loaded_extensions_basic.phpt @@ -13,11 +13,9 @@ echo "Get loaded extensions\n"; var_dump(get_loaded_extensions()); ?> -===DONE=== --EXPECTF-- *** Testing get_loaded_extensions() : basic functionality *** Get loaded extensions array(%d) { %a } -===DONE=== diff --git a/ext/standard/tests/general_functions/get_resource_type_basic.phpt b/ext/standard/tests/general_functions/get_resource_type_basic.phpt index 58a49e713f..dcad549c7b 100644 --- a/ext/standard/tests/general_functions/get_resource_type_basic.phpt +++ b/ext/standard/tests/general_functions/get_resource_type_basic.phpt @@ -13,8 +13,6 @@ $res = fopen(__FILE__, "r"); var_dump(get_resource_type($res)); ?> -===DONE=== --EXPECT-- *** Testing get_resource_type() : basic functionality *** string(6) "stream" -===DONE=== diff --git a/ext/standard/tests/general_functions/getopt.phpt b/ext/standard/tests/general_functions/getopt.phpt index 67864e9a96..4424072d1a 100644 --- a/ext/standard/tests/general_functions/getopt.phpt +++ b/ext/standard/tests/general_functions/getopt.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("d:m:j:vht")); + var_dump(getopt("d:m:j:vht")); ?> --EXPECT-- array(5) { diff --git a/ext/standard/tests/general_functions/getopt_002.phpt b/ext/standard/tests/general_functions/getopt_002.phpt index 1bf65e70ab..6ae2d3cb3d 100644 --- a/ext/standard/tests/general_functions/getopt_002.phpt +++ b/ext/standard/tests/general_functions/getopt_002.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("2a:vcd1")); + var_dump(getopt("2a:vcd1")); ?> --EXPECT-- array(4) { diff --git a/ext/standard/tests/general_functions/getopt_003.phpt b/ext/standard/tests/general_functions/getopt_003.phpt index e1a5146065..e40de84674 100644 --- a/ext/standard/tests/general_functions/getopt_003.phpt +++ b/ext/standard/tests/general_functions/getopt_003.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("2a:vcd1", array("another:", 12, 0, 1, "v"))); + var_dump(getopt("2a:vcd1", array("another:", 12, 0, 1, "v"))); ?> --EXPECT-- array(7) { diff --git a/ext/standard/tests/general_functions/getopt_004.phpt b/ext/standard/tests/general_functions/getopt_004.phpt index ac0aafe27b..5e8e810d38 100644 --- a/ext/standard/tests/general_functions/getopt_004.phpt +++ b/ext/standard/tests/general_functions/getopt_004.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("v::", array("v::"))); + var_dump(getopt("v::", array("v::"))); ?> --EXPECT-- array(1) { diff --git a/ext/standard/tests/general_functions/getopt_005.phpt b/ext/standard/tests/general_functions/getopt_005.phpt index 3fa1791eab..d75c4709ea 100644 --- a/ext/standard/tests/general_functions/getopt_005.phpt +++ b/ext/standard/tests/general_functions/getopt_005.phpt @@ -7,7 +7,7 @@ register_argc_argv=On variables_order=GPS --FILE-- <?php - var_dump(getopt("a:", array("arg:"))); + var_dump(getopt("a:", array("arg:"))); ?> --EXPECT-- array(2) { diff --git a/ext/standard/tests/general_functions/getrusage.phpt b/ext/standard/tests/general_functions/getrusage.phpt index 4caca88e1b..8ec131809f 100644 --- a/ext/standard/tests/general_functions/getrusage.phpt +++ b/ext/standard/tests/general_functions/getrusage.phpt @@ -8,16 +8,12 @@ getrusage() tests var_dump(gettype(getrusage())); var_dump(gettype(getrusage(1))); var_dump(gettype(getrusage(-1))); -var_dump(getrusage(array())); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- string(5) "array" string(5) "array" string(5) "array" - -Warning: getrusage() expects parameter 1 to be int, array given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/getrusage_basic.phpt b/ext/standard/tests/general_functions/getrusage_basic.phpt index a2b03ee07a..b057b57fae 100644 --- a/ext/standard/tests/general_functions/getrusage_basic.phpt +++ b/ext/standard/tests/general_functions/getrusage_basic.phpt @@ -15,16 +15,14 @@ echo "Simple testcase for getrusage() function\n"; $dat = getrusage(); if (!is_array($dat)) { - echo "TEST FAILED : getrusage should return an array\n"; + echo "TEST FAILED : getrusage should return an array\n"; } // echo the fields which are common to all platforms echo "User time used (seconds) " . $dat["ru_utime.tv_sec"] . "\n"; echo "User time used (microseconds) " . $dat["ru_utime.tv_usec"] . "\n"; ?> -===DONE=== --EXPECTF-- Simple testcase for getrusage() function User time used (seconds) %d User time used (microseconds) %d -===DONE=== diff --git a/ext/standard/tests/general_functions/getservbyname_basic.phpt b/ext/standard/tests/general_functions/getservbyname_basic.phpt index adaa7afb43..edc210fc39 100644 --- a/ext/standard/tests/general_functions/getservbyname_basic.phpt +++ b/ext/standard/tests/general_functions/getservbyname_basic.phpt @@ -8,12 +8,12 @@ Simone Gentili (sensorario@gmail.com) --FILE-- <?php - $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www'); + $services = array('http', 'ftp', 'ssh', 'telnet', 'imap', 'smtp', 'nicname', 'gopher', 'finger', 'pop3', 'www'); - foreach ($services as $service) { - $port = getservbyname($service, 'tcp'); - var_dump($port); - } + foreach ($services as $service) { + $port = getservbyname($service, 'tcp'); + var_dump($port); + } ?> diff --git a/ext/standard/tests/general_functions/getservbyport_basic.phpt b/ext/standard/tests/general_functions/getservbyport_basic.phpt index b9e0f83c98..cc02a4508e 100644 --- a/ext/standard/tests/general_functions/getservbyport_basic.phpt +++ b/ext/standard/tests/general_functions/getservbyport_basic.phpt @@ -7,21 +7,21 @@ Michele Orselli (mo@ideato.it) Simone Gentili (sensorario@gmail.com) --FILE-- <?php - if (file_exists("/etc/services")) { - $file = "/etc/services"; - } - elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services"; - else die(PHP_OS. " unsupported"); + if (file_exists("/etc/services")) { + $file = "/etc/services"; + } + elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services"; + else die(PHP_OS. " unsupported"); - if(file_exists($file)){ - $services = file_get_contents($file); + if(file_exists($file)){ + $services = file_get_contents($file); $service = getservbyport( 80, "tcp" ); if(preg_match("/$service\s+80\/tcp/", $services)) { - echo "PASS\n"; - } - }else{ - echo "Services file not found in expected location\n"; - } + echo "PASS\n"; + } + }else{ + echo "Services file not found in expected location\n"; + } ?> --EXPECT-- PASS diff --git a/ext/standard/tests/general_functions/getservbyport_variation1.phpt b/ext/standard/tests/general_functions/getservbyport_variation1.phpt index a876ac1fea..349fe16a94 100644 --- a/ext/standard/tests/general_functions/getservbyport_variation1.phpt +++ b/ext/standard/tests/general_functions/getservbyport_variation1.phpt @@ -9,32 +9,16 @@ Michele Orselli (mo@ideato.it) Simone Gentili (sensorario@gmail.com) --FILE-- <?php - var_dump(getservbyport( -1, "tcp" )); - var_dump(getservbyport( 80, "ppp" )); - var_dump(getservbyport( null, null)); - var_dump(getservbyport( array(), array())); - var_dump(getservbyport( array(80), array("tcp"))); - var_dump(getservbyport( array(2, 3), array("one"=>1, "two"=>2))); - var_dump(getservbyport( 2, 2)); - var_dump(getservbyport( "80", "tcp")); - var_dump(getservbyport( new stdClass(), new stdClass())); + var_dump(getservbyport( -1, "tcp" )); + var_dump(getservbyport( 80, "ppp" )); + var_dump(getservbyport( null, null)); + var_dump(getservbyport( 2, 2)); + var_dump(getservbyport( "80", "tcp")); ?> --EXPECTF-- bool(false) bool(false) bool(false) - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL - -Warning: getservbyport() expects parameter 1 to be int, array given in %s on line %d -NULL bool(false) string(%d) "%s" - -Warning: getservbyport() expects parameter 1 to be int, object given in %s on line %d -NULL diff --git a/ext/standard/tests/general_functions/gettype_settype_basic.phpt b/ext/standard/tests/general_functions/gettype_settype_basic.phpt index f8ff6c4460..80d12588e1 100644 --- a/ext/standard/tests/general_functions/gettype_settype_basic.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_basic.phpt @@ -93,14 +93,19 @@ foreach ($types as $type) { $loop_count = 1; foreach ($values as $var) { echo "-- Iteration $loop_count --\n"; $loop_count ++; - // set to new type - var_dump( settype($var, $type) ); - // dump the var - var_dump( $var ); + try { + // set to new type + var_dump( settype($var, $type) ); - // check the new type - var_dump( gettype($var) ); + // dump the var + var_dump( $var ); + + // check the new type + var_dump( gettype($var) ); + } catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; + } } } @@ -539,94 +544,33 @@ string(7) "boolean" -- Setting type of data to resource -- -- Iteration 1 -- -2: settype(): Cannot convert to resource type -bool(false) -array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) -} -string(5) "array" +Cannot convert to resource type -- Iteration 2 -- -2: settype(): Cannot convert to resource type -bool(false) -string(14) "another string" -string(6) "string" +Cannot convert to resource type -- Iteration 3 -- -2: settype(): Cannot convert to resource type -bool(false) -array(3) { - [0]=> - int(2) - [1]=> - int(3) - [2]=> - int(4) -} -string(5) "array" +Cannot convert to resource type -- Iteration 4 -- -2: settype(): Cannot convert to resource type -bool(false) -int(1) -string(7) "integer" +Cannot convert to resource type -- Iteration 5 -- -2: settype(): Cannot convert to resource type -bool(false) -int(-20) -string(7) "integer" +Cannot convert to resource type -- Iteration 6 -- -2: settype(): Cannot convert to resource type -bool(false) -float(2.54) -string(6) "double" +Cannot convert to resource type -- Iteration 7 -- -2: settype(): Cannot convert to resource type -bool(false) -float(-2.54) -string(6) "double" +Cannot convert to resource type -- Iteration 8 -- -2: settype(): Cannot convert to resource type -bool(false) -NULL -string(4) "NULL" +Cannot convert to resource type -- Iteration 9 -- -2: settype(): Cannot convert to resource type -bool(false) -bool(false) -string(7) "boolean" +Cannot convert to resource type -- Iteration 10 -- -2: settype(): Cannot convert to resource type -bool(false) -string(11) "some string" -string(6) "string" +Cannot convert to resource type -- Iteration 11 -- -2: settype(): Cannot convert to resource type -bool(false) -string(6) "string" -string(6) "string" +Cannot convert to resource type -- Iteration 12 -- -2: settype(): Cannot convert to resource type -bool(false) -resource(%d) of type (stream) -string(8) "resource" +Cannot convert to resource type -- Iteration 13 -- -2: settype(): Cannot convert to resource type -bool(false) -resource(%d) of type (stream) -string(8) "resource" +Cannot convert to resource type -- Iteration 14 -- -2: settype(): Cannot convert to resource type -bool(false) -object(point)#1 (2) { - ["x"]=> - int(10) - ["y"]=> - int(20) -} -string(6) "object" +Cannot convert to resource type -- Setting type of data to array -- -- Iteration 1 -- @@ -846,7 +790,7 @@ string(6) "object" -- Setting type of data to string -- -- Iteration 1 -- -8: Array to string conversion +2: Array to string conversion bool(true) string(5) "Array" string(6) "string" @@ -855,7 +799,7 @@ bool(true) string(14) "another string" string(6) "string" -- Iteration 3 -- -8: Array to string conversion +2: Array to string conversion bool(true) string(5) "Array" string(6) "string" diff --git a/ext/standard/tests/general_functions/gettype_settype_error.phpt b/ext/standard/tests/general_functions/gettype_settype_error.phpt index 325e91e47f..62e13e7259 100644 --- a/ext/standard/tests/general_functions/gettype_settype_error.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_error.phpt @@ -13,44 +13,20 @@ Test gettype() & settype() functions : error conditions echo "**** Testing gettype() and settype() functions ****\n"; -echo "\n*** Testing gettype(): error conditions ***\n"; -//Zero arguments -var_dump( gettype() ); -// args more than expected -var_dump( gettype( "1", "2" ) ); - echo "\n*** Testing settype(): error conditions ***\n"; -//Zero arguments -var_dump( settype() ); - -// args more than expected -$var = 10.5; -var_dump( settype( $var, $var, "int" ) ); // passing an invalid type to set -var_dump( settype( $var, "unknown" ) ); +try { + settype( $var, "unknown" ); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- **** Testing gettype() and settype() functions **** -*** Testing gettype(): error conditions *** - -Warning: gettype() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: gettype() expects exactly 1 parameter, 2 given in %s on line %d -NULL - *** Testing settype(): error conditions *** - -Warning: settype() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: settype() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: settype(): Invalid type in %s on line %d -bool(false) +settype(): Argument #2 ($type) must be a valid type Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt index 7fb8789ff3..93e69a2149 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation1.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation1.phpt @@ -1,5 +1,5 @@ --TEST-- -Test gettype() & settype() functions : usage variatoins +Test gettype() & settype() functions : usage variations --SKIPIF-- <?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); @@ -38,10 +38,6 @@ set_error_handler("foo"); $var1 = "another string"; $var2 = array(2,3,4); -// a variable which is unset -$unset_var = 10.5; -unset( $unset_var ); - class point { var $x; @@ -149,10 +145,6 @@ $var_values = array ( new point(NULL, NULL), new point(2.5, 40.5), new point(0, 0), - - /* undefined/unset vars */ - $unset_var, - $undef_var ); /* test conversion to null type */ @@ -180,9 +172,6 @@ foreach ($var_values as $var) { echo "Done\n"; ?> --EXPECT-- -8: Undefined variable: unset_var -8: Undefined variable: undef_var - *** Testing gettype() & settype() functions : usage variations *** -- Setting type of data to null -- @@ -576,14 +565,4 @@ string(6) "object" bool(true) NULL string(4) "NULL" --- Iteration 79 -- -string(4) "NULL" -bool(true) -NULL -string(4) "NULL" --- Iteration 80 -- -string(4) "NULL" -bool(true) -NULL -string(4) "NULL" Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt index d44c04e5dd..36b0e75485 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation2.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation2.phpt @@ -24,7 +24,7 @@ precision=14 Set type of the data to "int"/"integer" and verify using gettype Following are performed in the listed sequence: get the current type of the variable - set the type of the variable to interger/int type + set the type of the variable to integer/int type dump the variable to see its new data get the new type of the variable */ @@ -42,10 +42,6 @@ set_error_handler("foo"); $var1 = "another string"; $var2 = array(2,3,4); -// a variable which is unset -$unset_var = 10.5; -unset( $unset_var ); - class point { var $x; @@ -153,10 +149,6 @@ $var_values = array ( new point(NULL, NULL), new point(2.5, 40.5), new point(0, 0), - - /* undefined/unset vars */ - $unset_var, - $undef_var ); // test conversion to these types @@ -189,9 +181,6 @@ foreach ($types as $type) { echo "Done\n"; ?> --EXPECT-- -8: Undefined variable: unset_var -8: Undefined variable: undef_var - *** Testing settype() & gettype() : usage variations *** -- Setting type of data to integer -- @@ -588,16 +577,6 @@ string(6) "object" bool(true) int(1) string(7) "integer" --- Iteration 79 -- -string(4) "NULL" -bool(true) -int(0) -string(7) "integer" --- Iteration 80 -- -string(4) "NULL" -bool(true) -int(0) -string(7) "integer" -- Setting type of data to int -- -- Iteration 1 -- @@ -993,14 +972,4 @@ string(6) "object" bool(true) int(1) string(7) "integer" --- Iteration 79 -- -string(4) "NULL" -bool(true) -int(0) -string(7) "integer" --- Iteration 80 -- -string(4) "NULL" -bool(true) -int(0) -string(7) "integer" Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt index 71b03461eb..60c1d76cc6 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation3.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation3.phpt @@ -4,8 +4,6 @@ Test gettype() & settype() functions : usage variations <?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); ?> ---INI-- -precision=14 --FILE-- <?php /* Prototype: string gettype ( mixed $var ); @@ -38,10 +36,6 @@ set_error_handler("foo"); $var1 = "another string"; $var2 = array(2,3,4); -// a variable which is unset -$unset_var = 10.5; -unset( $unset_var ); - class point { var $x; @@ -149,10 +143,6 @@ $var_values = array ( new point(NULL, NULL), new point(2.5, 40.5), new point(0, 0), - - /* undefined/unset vars */ - $unset_var, - $undef_var ); // test conversion to these types @@ -185,9 +175,6 @@ foreach ($types as $type) { echo "Done\n"; ?> --EXPECT-- -8: Undefined variable: unset_var -8: Undefined variable: undef_var - *** Testing settype() & gettype() : usage variations *** -- Setting type of data to float -- @@ -289,7 +276,7 @@ string(6) "double" -- Iteration 20 -- string(6) "string" bool(true) -float(2.9743947493287E+21) +float(2.974394749328742E+21) string(6) "double" -- Iteration 21 -- string(6) "string" @@ -319,7 +306,7 @@ string(6) "double" -- Iteration 26 -- string(6) "string" bool(true) -float(2.9743947493287E+21) +float(2.974394749328742E+21) string(6) "double" -- Iteration 27 -- string(6) "string" @@ -584,16 +571,6 @@ string(6) "object" bool(true) float(1) string(6) "double" --- Iteration 79 -- -string(4) "NULL" -bool(true) -float(0) -string(6) "double" --- Iteration 80 -- -string(4) "NULL" -bool(true) -float(0) -string(6) "double" -- Setting type of data to double -- -- Iteration 1 -- @@ -694,7 +671,7 @@ string(6) "double" -- Iteration 20 -- string(6) "string" bool(true) -float(2.9743947493287E+21) +float(2.974394749328742E+21) string(6) "double" -- Iteration 21 -- string(6) "string" @@ -724,7 +701,7 @@ string(6) "double" -- Iteration 26 -- string(6) "string" bool(true) -float(2.9743947493287E+21) +float(2.974394749328742E+21) string(6) "double" -- Iteration 27 -- string(6) "string" @@ -989,14 +966,4 @@ string(6) "object" bool(true) float(1) string(6) "double" --- Iteration 79 -- -string(4) "NULL" -bool(true) -float(0) -string(6) "double" --- Iteration 80 -- -string(4) "NULL" -bool(true) -float(0) -string(6) "double" Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt index a14cb73dbb..00da4bf4bb 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation4.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation4.phpt @@ -38,10 +38,6 @@ set_error_handler("foo"); $var1 = "another string"; $var2 = array(2,3,4); -// a variable which is unset -$unset_var = 10.5; -unset( $unset_var ); - class point { var $x; @@ -160,10 +156,6 @@ $var_values = array ( new point(0, 0), new class_with_no_member, - /* undefined/unset vars */ - $unset_var, - $undef_var, - /* binary strings */ b"0", b'0', @@ -210,9 +202,6 @@ foreach ($types as $type) { echo "Done\n"; ?> --EXPECT-- -8: Undefined variable: unset_var -8: Undefined variable: undef_var - *** Testing settype() & gettype() : usage variations *** -- Setting type of data to boolean -- @@ -632,24 +621,24 @@ bool(true) bool(true) string(7) "boolean" -- Iteration 84 -- -string(4) "NULL" +string(6) "string" bool(true) bool(false) string(7) "boolean" -- Iteration 85 -- -string(4) "NULL" +string(6) "string" bool(true) bool(false) string(7) "boolean" -- Iteration 86 -- string(6) "string" bool(true) -bool(false) +bool(true) string(7) "boolean" -- Iteration 87 -- string(6) "string" bool(true) -bool(false) +bool(true) string(7) "boolean" -- Iteration 88 -- string(6) "string" @@ -696,16 +685,6 @@ string(6) "string" bool(true) bool(true) string(7) "boolean" --- Iteration 97 -- -string(6) "string" -bool(true) -bool(true) -string(7) "boolean" --- Iteration 98 -- -string(6) "string" -bool(true) -bool(true) -string(7) "boolean" -- Setting type of data to bool -- -- Iteration 1 -- @@ -1124,24 +1103,24 @@ bool(true) bool(true) string(7) "boolean" -- Iteration 84 -- -string(4) "NULL" +string(6) "string" bool(true) bool(false) string(7) "boolean" -- Iteration 85 -- -string(4) "NULL" +string(6) "string" bool(true) bool(false) string(7) "boolean" -- Iteration 86 -- string(6) "string" bool(true) -bool(false) +bool(true) string(7) "boolean" -- Iteration 87 -- string(6) "string" bool(true) -bool(false) +bool(true) string(7) "boolean" -- Iteration 88 -- string(6) "string" @@ -1188,14 +1167,4 @@ string(6) "string" bool(true) bool(true) string(7) "boolean" --- Iteration 97 -- -string(6) "string" -bool(true) -bool(true) -string(7) "boolean" --- Iteration 98 -- -string(6) "string" -bool(true) -bool(true) -string(7) "boolean" Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt index c5e2640f9c..f9f0059bfa 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation5.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation5.phpt @@ -24,24 +24,9 @@ precision=14 dump the variable to see its new data get the new type of the variable */ - -/* function to handle catchable errors */ -function foo($errno, $errstr, $errfile, $errline) { -// var_dump($errstr); - // print error no and error string - echo "$errno: $errstr\n"; -} -//set the error handler, this is required as -// settype() would fail with catachable fatal error -set_error_handler("foo"); - $var1 = "another string"; $var2 = array(2,3,4); -// a variable which is unset -$unset_var = 10.5; -unset( $unset_var ); - class point { var $x; @@ -67,7 +52,7 @@ $var_values = array ( true, /* strings */ - "\xFF", + "\$", "\x66", "\0123", "", @@ -149,10 +134,6 @@ $var_values = array ( new point(NULL, NULL), new point(2.5, 40.5), new point(0, 0), - - /* undefined/unset vars */ - $unset_var, - $undef_var ); /* test conversion to resource type */ @@ -167,289 +148,246 @@ foreach ($var_values as $var) { // get the current data type var_dump( gettype($var) ); - // convert it to null - var_dump( settype($var, $type) ); + // convert it to resource + try { + var_dump(settype($var, $type)); + } catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; + } // dump the converted data - var_dump( $var ); + var_dump($var); // check the new type after conversion - var_dump( gettype($var) ); + var_dump(gettype($var)); } echo "Done\n"; ?> --EXPECT-- -8: Undefined variable: unset_var -8: Undefined variable: undef_var - *** Testing gettype() & settype() functions : usage variations *** -- Setting type of data to resource -- -- Iteration 1 -- string(4) "NULL" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type NULL string(4) "NULL" -- Iteration 2 -- string(7) "boolean" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type bool(false) string(7) "boolean" -- Iteration 3 -- string(7) "boolean" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type bool(true) string(7) "boolean" -- Iteration 4 -- string(7) "boolean" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type bool(true) string(7) "boolean" -- Iteration 5 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) -string(1) "ÿ" +Cannot convert to resource type +string(1) "$" string(6) "string" -- Iteration 6 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(1) "f" string(6) "string" -- Iteration 7 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(2) " 3" string(6) "string" -- Iteration 8 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(0) "" string(6) "string" -- Iteration 9 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(0) "" string(6) "string" -- Iteration 10 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(1) " " string(6) "string" -- Iteration 11 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(1) " " string(6) "string" -- Iteration 12 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(2) "10" string(6) "string" -- Iteration 13 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(2) "10" string(6) "string" -- Iteration 14 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(8) "10string" string(6) "string" -- Iteration 15 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(8) "10string" string(6) "string" -- Iteration 16 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(1) "1" string(6) "string" -- Iteration 17 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(2) "-1" string(6) "string" -- Iteration 18 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(3) "1e2" string(6) "string" -- Iteration 19 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(2) " 1" string(6) "string" -- Iteration 20 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(22) "2974394749328742328432" string(6) "string" -- Iteration 21 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(5) "-1e-2" string(6) "string" -- Iteration 22 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(1) "1" string(6) "string" -- Iteration 23 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(2) "-1" string(6) "string" -- Iteration 24 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(3) "1e2" string(6) "string" -- Iteration 25 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(2) " 1" string(6) "string" -- Iteration 26 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(22) "2974394749328742328432" string(6) "string" -- Iteration 27 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(5) "-1e-2" string(6) "string" -- Iteration 28 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(4) "0xff" string(6) "string" -- Iteration 29 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(4) "0x55" string(6) "string" -- Iteration 30 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(5) "0XA55" string(6) "string" -- Iteration 31 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(5) "0X123" string(6) "string" -- Iteration 32 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(4) "0123" string(6) "string" -- Iteration 33 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(4) "0123" string(6) "string" -- Iteration 34 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(5) "-0123" string(6) "string" -- Iteration 35 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(5) "+0123" string(6) "string" -- Iteration 36 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(5) "-0123" string(6) "string" -- Iteration 37 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(5) "+0123" string(6) "string" -- Iteration 38 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(8) "-0x80001" string(6) "string" -- Iteration 39 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(8) "+0x80001" string(6) "string" -- Iteration 40 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(10) "-0x80001.5" string(6) "string" -- Iteration 41 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(9) "0x80001.5" string(6) "string" -- Iteration 42 -- string(6) "string" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type string(12) "@$%#$%^$%^&^" string(6) "string" -- Iteration 43 -- string(5) "array" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type array(0) { } string(5) "array" -- Iteration 44 -- string(5) "array" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type array(1) { [0]=> NULL @@ -457,8 +395,7 @@ array(1) { string(5) "array" -- Iteration 45 -- string(5) "array" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type array(4) { [0]=> int(1) @@ -472,8 +409,7 @@ array(4) { string(5) "array" -- Iteration 46 -- string(5) "array" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type array(4) { [1]=> string(3) "one" @@ -487,8 +423,7 @@ array(4) { string(5) "array" -- Iteration 47 -- string(5) "array" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type array(3) { [0]=> float(1.5) @@ -500,176 +435,147 @@ array(3) { string(5) "array" -- Iteration 48 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-2147483648) string(6) "double" -- Iteration 49 -- string(7) "integer" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type int(2147483647) string(7) "integer" -- Iteration 50 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(2147483649) string(6) "double" -- Iteration 51 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(1232147483649) string(6) "double" -- Iteration 52 -- string(7) "integer" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type int(85) string(7) "integer" -- Iteration 53 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(1058513956921) string(6) "double" -- Iteration 54 -- string(7) "integer" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type int(-21903) string(7) "integer" -- Iteration 55 -- string(7) "integer" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type int(365) string(7) "integer" -- Iteration 56 -- string(7) "integer" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type int(-365) string(7) "integer" -- Iteration 57 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(80561044571754) string(6) "double" -- Iteration 58 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(100000) string(6) "double" -- Iteration 59 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-100000) string(6) "double" -- Iteration 60 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(100000) string(6) "double" -- Iteration 61 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-100000) string(6) "double" -- Iteration 62 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-1.5) string(6) "double" -- Iteration 63 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(0.5) string(6) "double" -- Iteration 64 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-0.5) string(6) "double" -- Iteration 65 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(500000) string(6) "double" -- Iteration 66 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-500000) string(6) "double" -- Iteration 67 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-5.0E-7) string(6) "double" -- Iteration 68 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(500000) string(6) "double" -- Iteration 69 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-500000) string(6) "double" -- Iteration 70 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(512000) string(6) "double" -- Iteration 71 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-512000) string(6) "double" -- Iteration 72 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(5.12E-7) string(6) "double" -- Iteration 73 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(5.12E-7) string(6) "double" -- Iteration 74 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(512000) string(6) "double" -- Iteration 75 -- string(6) "double" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type float(-512000) string(6) "double" -- Iteration 76 -- string(6) "object" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type object(point)#1 (2) { ["x"]=> NULL @@ -679,8 +585,7 @@ object(point)#1 (2) { string(6) "object" -- Iteration 77 -- string(6) "object" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type object(point)#2 (2) { ["x"]=> float(2.5) @@ -690,8 +595,7 @@ object(point)#2 (2) { string(6) "object" -- Iteration 78 -- string(6) "object" -2: settype(): Cannot convert to resource type -bool(false) +Cannot convert to resource type object(point)#3 (2) { ["x"]=> int(0) @@ -699,16 +603,4 @@ object(point)#3 (2) { int(0) } string(6) "object" --- Iteration 79 -- -string(4) "NULL" -2: settype(): Cannot convert to resource type -bool(false) -NULL -string(4) "NULL" --- Iteration 80 -- -string(4) "NULL" -2: settype(): Cannot convert to resource type -bool(false) -NULL -string(4) "NULL" Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt index 27beaa0744..7c5ea5efb6 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation6.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation6.phpt @@ -38,10 +38,6 @@ set_error_handler("foo"); $var1 = "another string"; $var2 = array(2,3,4); -// a variable which is unset -$unset_var = 10.5; -unset( $unset_var ); - class point { var $x; @@ -149,10 +145,6 @@ $var_values = array ( new point(NULL, NULL), new point(2.5, 40.5), new point(0, 0), - - /* undefined/unset vars */ - $unset_var, - $undef_var ); /* test conversion to array type */ @@ -181,10 +173,7 @@ foreach ($var_values as $var) { echo "Done\n"; ?> ---EXPECT-- -8: Undefined variable: unset_var -8: Undefined variable: undef_var - +--EXPECTF-- *** Testing gettype() & settype() functions : usage variations *** -- Setting type of data to array -- @@ -831,16 +820,4 @@ array(2) { int(0) } string(5) "array" --- Iteration 79 -- -string(4) "NULL" -bool(true) -array(0) { -} -string(5) "array" --- Iteration 80 -- -string(4) "NULL" -bool(true) -array(0) { -} -string(5) "array" Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt index dae20a1856..b282cbdab1 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation7.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation7.phpt @@ -38,10 +38,6 @@ set_error_handler("foo"); $var1 = "another string"; $var2 = array(2,3,4); -// a variable which is unset -$unset_var = 10.5; -unset( $unset_var ); - class point { var $x; @@ -149,10 +145,6 @@ $var_values = array ( new point(NULL, NULL), new point(2.5, 40.5), new point(0, 0), - - /* undefined/unset vars */ - $unset_var, - $undef_var ); /* test conversion to object type */ @@ -179,10 +171,7 @@ foreach ($var_values as $var) { echo "Done\n"; ?> ---EXPECT-- -8: Undefined variable: unset_var -8: Undefined variable: undef_var - +--EXPECTF-- *** Testing gettype() & settype() functions : usage variations *** -- Setting type of data to object -- @@ -829,16 +818,4 @@ object(point)#3 (2) { int(0) } string(6) "object" --- Iteration 79 -- -string(4) "NULL" -bool(true) -object(stdClass)#4 (0) { -} -string(6) "object" --- Iteration 80 -- -string(4) "NULL" -bool(true) -object(stdClass)#4 (0) { -} -string(6) "object" Done diff --git a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt index 97f550e446..7ddfe54ab6 100644 --- a/ext/standard/tests/general_functions/gettype_settype_variation8.phpt +++ b/ext/standard/tests/general_functions/gettype_settype_variation8.phpt @@ -38,10 +38,6 @@ set_error_handler("foo"); $var1 = "another string"; $var2 = array(2,3,4); -// a variable which is unset -$unset_var = 10.5; -unset( $unset_var ); - class point { var $x; @@ -149,10 +145,6 @@ $var_values = array ( new point(NULL, NULL), new point(2.5, 40.5), new point(0, 0), - - /* undefined/unset vars */ - $unset_var, - $undef_var ); /* test conversion to string type */ @@ -179,10 +171,7 @@ foreach ($var_values as $var) { echo "Done\n"; ?> ---EXPECT-- -8: Undefined variable: unset_var -8: Undefined variable: undef_var - +--EXPECTF-- *** Testing gettype() & settype() functions : usage variations *** -- Setting type of data to string -- @@ -399,31 +388,31 @@ string(12) "@$%#$%^$%^&^" string(6) "string" -- Iteration 43 -- string(5) "array" -8: Array to string conversion +2: Array to string conversion bool(true) string(5) "Array" string(6) "string" -- Iteration 44 -- string(5) "array" -8: Array to string conversion +2: Array to string conversion bool(true) string(5) "Array" string(6) "string" -- Iteration 45 -- string(5) "array" -8: Array to string conversion +2: Array to string conversion bool(true) string(5) "Array" string(6) "string" -- Iteration 46 -- string(5) "array" -8: Array to string conversion +2: Array to string conversion bool(true) string(5) "Array" string(6) "string" -- Iteration 47 -- string(5) "array" -8: Array to string conversion +2: Array to string conversion bool(true) string(5) "Array" string(6) "string" @@ -582,14 +571,4 @@ string(6) "object" bool(true) string(11) "ObjectPoint" string(6) "string" --- Iteration 79 -- -string(4) "NULL" -bool(true) -string(0) "" -string(6) "string" --- Iteration 80 -- -string(4) "NULL" -bool(true) -string(0) "" -string(6) "string" Done diff --git a/ext/standard/tests/general_functions/head.phpt b/ext/standard/tests/general_functions/head.phpt index 059c56b258..f8d4c28338 100644 --- a/ext/standard/tests/general_functions/head.phpt +++ b/ext/standard/tests/general_functions/head.phpt @@ -1,11 +1,5 @@ --TEST-- header() and friends ---SKIPIF-- -<?php -if (php_sapi_name() != "cli") { - die("skip this test is for CLI"); -} -?> --FILE-- <?php diff --git a/ext/standard/tests/general_functions/include_path.phpt b/ext/standard/tests/general_functions/include_path.phpt index 23c5bc45aa..06e806b3a2 100644 --- a/ext/standard/tests/general_functions/include_path.phpt +++ b/ext/standard/tests/general_functions/include_path.phpt @@ -6,82 +6,46 @@ include_path=. <?php var_dump(get_include_path()); -var_dump(get_include_path("var")); +var_dump(ini_restore("include_path")); -var_dump(restore_include_path()); -var_dump(restore_include_path("")); - - -var_dump(set_include_path()); -var_dump(get_include_path()); var_dump(set_include_path("var")); var_dump(get_include_path()); -var_dump(restore_include_path()); +var_dump(ini_restore("include_path")); var_dump(get_include_path()); var_dump(set_include_path(".:/path/to/dir")); var_dump(get_include_path()); -var_dump(restore_include_path()); +var_dump(ini_restore("include_path")); var_dump(get_include_path()); var_dump(set_include_path("")); var_dump(get_include_path()); -var_dump(restore_include_path()); +var_dump(ini_restore("include_path")); var_dump(get_include_path()); -var_dump(set_include_path(array())); +var_dump(ini_restore("include_path")); var_dump(get_include_path()); -var_dump(restore_include_path()); -var_dump(get_include_path()); - - echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- string(1) "." - -Warning: get_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Deprecated: Function restore_include_path() is deprecated in %s on line %d -NULL - -Deprecated: Function restore_include_path() is deprecated in %s on line %d - -Warning: restore_include_path() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: set_include_path() expects exactly 1 parameter, 0 given in %s on line %d NULL string(1) "." -string(1) "." string(3) "var" - -Deprecated: Function restore_include_path() is deprecated in %s on line %d NULL string(1) "." string(1) "." string(14) ".:/path/to/dir" - -Deprecated: Function restore_include_path() is deprecated in %s on line %d NULL string(1) "." bool(false) string(1) "." - -Deprecated: Function restore_include_path() is deprecated in %s on line %d NULL string(1) "." - -Warning: set_include_path() expects parameter 1 to be a valid path, array given in %s on line %d -NULL -string(1) "." - -Deprecated: Function restore_include_path() is deprecated in %s on line %d NULL string(1) "." Done diff --git a/ext/standard/tests/general_functions/intval.phpt b/ext/standard/tests/general_functions/intval.phpt index 1650b91c6f..c56bdd7b94 100644 --- a/ext/standard/tests/general_functions/intval.phpt +++ b/ext/standard/tests/general_functions/intval.phpt @@ -146,13 +146,6 @@ foreach ($not_int_types as $type ) { var_dump( intval($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( intval() ); - -//arguments more than expected -var_dump( intval(TRUE, FALSE, TRUE) ); - echo "\n--- Done ---\n"; @@ -295,12 +288,4 @@ int(0) int(0) int(0) -*** Testing error conditions *** - -Warning: intval() expects at least 1 parameter, 0 given in %s on line %d -NULL - -Warning: intval() expects at most 2 parameters, 3 given in %s on line %d -NULL - --- Done --- diff --git a/ext/standard/tests/general_functions/intval_variation1.phpt b/ext/standard/tests/general_functions/intval_variation1.phpt index e76d7083d4..c968b39a90 100644 --- a/ext/standard/tests/general_functions/intval_variation1.phpt +++ b/ext/standard/tests/general_functions/intval_variation1.phpt @@ -11,11 +11,11 @@ Test intval() function : usage variation echo "*** Testing intval() : usage variation ***\n"; // Define error handler -function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) { - if (error_reporting() != 0) { - // report non-silenced errors - echo "Error: $err_no - $err_msg, $filename($linenum)\n"; - } +function test_error_handler($err_no, $err_msg, $filename, $linenum) { + if (error_reporting() & $err_no) { + // report non-silenced errors + echo "Error: $err_no - $err_msg, $filename($linenum)\n"; + } } set_error_handler('test_error_handler'); @@ -29,9 +29,9 @@ unset ($unset_var); // define some classes class classWithToString { - public function __toString() { - return "Class A object"; - } + public function __toString() { + return "Class A object"; + } } class classWithoutToString @@ -108,7 +108,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing intval() : usage variation *** @@ -200,4 +199,3 @@ int(0) --unset var-- int(0) -===DONE=== diff --git a/ext/standard/tests/general_functions/is_array.phpt b/ext/standard/tests/general_functions/is_array.phpt index 66e5b64934..37de6d5a5b 100644 --- a/ext/standard/tests/general_functions/is_array.phpt +++ b/ext/standard/tests/general_functions/is_array.phpt @@ -98,19 +98,12 @@ foreach ($varient_arrays as $type ) { var_dump( is_array ($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_array() ); - -//arguments more than expected -var_dump( is_array ($fp, $fp) ); - echo "Done\n"; /* close resources */ fclose($fp); closedir($dfp); ?> ---EXPECTF-- +--EXPECT-- *** Testing is_array() on different type of arrays *** -- Iteration 1 -- bool(true) @@ -202,12 +195,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_array() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_array() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_bool.phpt b/ext/standard/tests/general_functions/is_bool.phpt index 34d5e0ef6c..70aaed9c3f 100644 --- a/ext/standard/tests/general_functions/is_bool.phpt +++ b/ext/standard/tests/general_functions/is_bool.phpt @@ -127,13 +127,6 @@ foreach ($not_bool_types as $type ) { var_dump( is_bool($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_bool() ); - -//arguments more than expected -var_dump( is_bool(TRUE, FALSE) ); - echo "Done\n"; // close resources @@ -141,7 +134,7 @@ fclose($fp); closedir($dfp); ?> ---EXPECTF-- +--EXPECT-- *** Testing is_bool() with valid boolean values *** -- Iteration 1 -- bool(true) @@ -283,12 +276,4 @@ bool(false) bool(false) -- Iteration 65 -- bool(false) - -*** Testing error conditions *** - -Warning: is_bool() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_bool() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_callable_basic1.phpt b/ext/standard/tests/general_functions/is_callable_basic1.phpt index aa4c9aee23..50eb710e90 100644 --- a/ext/standard/tests/general_functions/is_callable_basic1.phpt +++ b/ext/standard/tests/general_functions/is_callable_basic1.phpt @@ -60,7 +60,6 @@ $defined_functions = array ( check_iscallable($defined_functions); ?> -===DONE=== --EXPECT-- *** Testing is_callable() on defined functions *** -- Iteration 1 -- @@ -103,4 +102,3 @@ Hello_World bool(true) bool(true) Hello_World -===DONE=== diff --git a/ext/standard/tests/general_functions/is_callable_basic2.phpt b/ext/standard/tests/general_functions/is_callable_basic2.phpt index 7657875311..2927b43d40 100644 --- a/ext/standard/tests/general_functions/is_callable_basic2.phpt +++ b/ext/standard/tests/general_functions/is_callable_basic2.phpt @@ -116,6 +116,7 @@ foreach($objects as $object) { array( @$temp_class_obj->value, 100 ), array( $object, 'func' ), array( 'object_class', 'foo1' ), + $object, ); /* use check_iscallable_objects() to check whether given object/string has valid method name */ @@ -124,7 +125,6 @@ foreach($objects as $object) { } ?> -===DONE=== --EXPECT-- *** Testing is_callable() on objects *** @@ -207,13 +207,21 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 1 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 +-- Innerloop iteration 11 of Outerloop iteration 1 -- +bool(false) +bool(false) +bool(false) +bool(false) +object_class::__invoke +bool(false) +object_class::__invoke --- Outerloop iteration 2 --- -- Innerloop iteration 1 of Outerloop iteration 2 -- bool(false) @@ -288,13 +296,21 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 2 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 +-- Innerloop iteration 11 of Outerloop iteration 2 -- +bool(false) +bool(false) +bool(false) +bool(false) +no_member_class::__invoke +bool(false) +no_member_class::__invoke --- Outerloop iteration 3 --- -- Innerloop iteration 1 of Outerloop iteration 3 -- bool(false) @@ -369,13 +385,21 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 3 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 +-- Innerloop iteration 11 of Outerloop iteration 3 -- +bool(false) +bool(false) +bool(false) +bool(false) +contains_object_class::__invoke +bool(false) +contains_object_class::__invoke --- Outerloop iteration 4 --- -- Innerloop iteration 1 of Outerloop iteration 4 -- bool(false) @@ -450,13 +474,21 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 4 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 +-- Innerloop iteration 11 of Outerloop iteration 4 -- +bool(false) +bool(false) +bool(false) +bool(false) +contains_object_class::__invoke +bool(false) +contains_object_class::__invoke --- Outerloop iteration 5 --- -- Innerloop iteration 1 of Outerloop iteration 5 -- bool(true) @@ -531,13 +563,21 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 5 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 +-- Innerloop iteration 11 of Outerloop iteration 5 -- +bool(false) +bool(false) +bool(false) +bool(false) +object_class::__invoke +bool(false) +object_class::__invoke --- Outerloop iteration 6 --- -- Innerloop iteration 1 of Outerloop iteration 6 -- bool(false) @@ -612,13 +652,21 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 6 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 +-- Innerloop iteration 11 of Outerloop iteration 6 -- +bool(false) +bool(false) +bool(false) +bool(false) +no_member_class::__invoke +bool(false) +no_member_class::__invoke --- Outerloop iteration 7 --- -- Innerloop iteration 1 of Outerloop iteration 7 -- bool(true) @@ -693,13 +741,21 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 7 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 +-- Innerloop iteration 11 of Outerloop iteration 7 -- +bool(false) +bool(false) +bool(false) +bool(false) +object_class::__invoke +bool(false) +object_class::__invoke --- Outerloop iteration 8 --- -- Innerloop iteration 1 of Outerloop iteration 8 -- bool(false) @@ -774,11 +830,17 @@ Array bool(false) Array -- Innerloop iteration 10 of Outerloop iteration 8 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 -===DONE=== +-- Innerloop iteration 11 of Outerloop iteration 8 -- +bool(false) +bool(false) +bool(false) +bool(false) + +bool(false) diff --git a/ext/standard/tests/general_functions/is_callable_variation1.phpt b/ext/standard/tests/general_functions/is_callable_variation1.phpt index 022c5a4549..4bb7f28a16 100644 --- a/ext/standard/tests/general_functions/is_callable_variation1.phpt +++ b/ext/standard/tests/general_functions/is_callable_variation1.phpt @@ -59,7 +59,6 @@ $undef_functions = array ( check_iscallable($undef_functions); ?> -===DONE=== --EXPECT-- *** Testing is_callable() on undefined functions *** -- Iteration 1 -- @@ -206,4 +205,3 @@ bool(true) bool(false) bool(false) "echo()" -===DONE=== diff --git a/ext/standard/tests/general_functions/is_callable_variation2.phpt b/ext/standard/tests/general_functions/is_callable_variation2.phpt index af562d4ef1..2c53939545 100644 --- a/ext/standard/tests/general_functions/is_callable_variation2.phpt +++ b/ext/standard/tests/general_functions/is_callable_variation2.phpt @@ -57,7 +57,6 @@ check_iscallable($variants); fclose($file_handle); ?> -===DONE=== --EXPECTF-- *** Testing is_callable() on invalid function names *** -- Iteration 1 -- @@ -148,4 +147,3 @@ Resource id #%d bool(false) bool(false) Resource id #%d -===DONE=== diff --git a/ext/standard/tests/general_functions/is_countable_with_variables.phpt b/ext/standard/tests/general_functions/is_countable_with_variables.phpt index 700077ef17..0cb18769d6 100644 --- a/ext/standard/tests/general_functions/is_countable_with_variables.phpt +++ b/ext/standard/tests/general_functions/is_countable_with_variables.phpt @@ -7,7 +7,6 @@ Gabriel Caruso (carusogabriel34@gmail.com) var_dump(is_countable([1, 2, 3])); var_dump(is_countable((array) 1)); var_dump(is_countable((object) ['foo', 'bar', 'baz'])); -var_dump(is_countable()); $foo = ['', []]; @@ -24,9 +23,6 @@ if (!is_countable($bar)) { bool(true) bool(true) bool(false) - -Warning: is_countable() expects exactly 1 parameter, 0 given in %s on line %d -NULL int(2) Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d diff --git a/ext/standard/tests/general_functions/is_float.phpt b/ext/standard/tests/general_functions/is_float.phpt index 6d4ada6701..f29816f606 100644 --- a/ext/standard/tests/general_functions/is_float.phpt +++ b/ext/standard/tests/general_functions/is_float.phpt @@ -1,5 +1,5 @@ --TEST-- -Test is_float() & it's FALIASes: is_double() & is_real() functions +Test is_float() & its is_double() alias --SKIPIF-- <?php if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); @@ -10,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); * Description: Finds whether the given variable is a float */ -echo "*** Testing is_float(), is_double() and is_real() with float values***\n"; +echo "*** Testing is_float(), is_double() with float values***\n"; // different valid float values $floats = array( -2147483649, // float value @@ -44,17 +44,16 @@ $floats = array( .0034E-30, -.0034E-30 ); -/* loop to check that is_float(), is_double() & is_real() recognizes +/* loop to check that is_float(), is_double() & recognizes different float values, expected: bool(true) */ $loop_counter = 1; foreach ($floats as $float ) { echo "-- Iteration $loop_counter --\n"; $loop_counter++; var_dump( is_float($float) ); var_dump( is_double($float) ); - var_dump( @is_real($float) ); } -echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n"; +echo "\n*** Testing is_float(), is_double() with non float values ***\n"; // get a resource type variable $fp = fopen (__FILE__, "r"); $dfp = opendir ( __DIR__ ); @@ -117,27 +116,15 @@ $not_floats = array ( @$undefined_var ); /* loop through the $not_floats to see working of - is_float(), is_double() & is_real() on objects, + is_float(), is_double() on objects, arrays, boolean and others */ $loop_counter = 1; foreach ($not_floats as $value ) { echo "--Iteration $loop_counter--\n"; $loop_counter++; var_dump( is_float($value) ); var_dump( is_double($value) ); - var_dump( @is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; // close the resources used @@ -146,299 +133,208 @@ closedir($dfp); ?> --EXPECTF-- -*** Testing is_float(), is_double() and is_real() with float values*** +*** Testing is_float(), is_double() with float values*** -- Iteration 1 -- bool(true) bool(true) -bool(true) -- Iteration 2 -- bool(true) bool(true) -bool(true) -- Iteration 3 -- bool(true) bool(true) -bool(true) -- Iteration 4 -- bool(true) bool(true) -bool(true) -- Iteration 5 -- bool(true) bool(true) -bool(true) -- Iteration 6 -- bool(true) bool(true) -bool(true) -- Iteration 7 -- bool(true) bool(true) -bool(true) -- Iteration 8 -- bool(true) bool(true) -bool(true) -- Iteration 9 -- bool(true) bool(true) -bool(true) -- Iteration 10 -- bool(true) bool(true) -bool(true) -- Iteration 11 -- bool(true) bool(true) -bool(true) -- Iteration 12 -- bool(true) bool(true) -bool(true) -- Iteration 13 -- bool(true) bool(true) -bool(true) -- Iteration 14 -- bool(true) bool(true) -bool(true) -- Iteration 15 -- bool(true) bool(true) -bool(true) -- Iteration 16 -- bool(true) bool(true) -bool(true) -- Iteration 17 -- bool(true) bool(true) -bool(true) -- Iteration 18 -- bool(true) bool(true) -bool(true) -- Iteration 19 -- bool(true) bool(true) -bool(true) -- Iteration 20 -- bool(true) bool(true) -bool(true) -- Iteration 21 -- bool(true) bool(true) -bool(true) -- Iteration 22 -- bool(true) bool(true) -bool(true) -- Iteration 23 -- bool(true) bool(true) -bool(true) -- Iteration 24 -- bool(true) bool(true) -bool(true) -- Iteration 25 -- bool(true) bool(true) -bool(true) -- Iteration 26 -- bool(true) bool(true) -bool(true) -- Iteration 27 -- bool(true) bool(true) -bool(true) -- Iteration 28 -- bool(true) bool(true) -bool(true) -- Iteration 29 -- bool(true) bool(true) -bool(true) -- Iteration 30 -- bool(true) bool(true) -bool(true) -*** Testing is_float(), is_double() & is_real() with non float values *** +*** Testing is_float(), is_double() with non float values *** --Iteration 1-- bool(false) bool(false) -bool(false) --Iteration 2-- bool(false) bool(false) -bool(false) --Iteration 3-- bool(false) bool(false) -bool(false) --Iteration 4-- bool(false) bool(false) -bool(false) --Iteration 5-- bool(false) bool(false) -bool(false) --Iteration 6-- bool(false) bool(false) -bool(false) --Iteration 7-- bool(false) bool(false) -bool(false) --Iteration 8-- bool(false) bool(false) -bool(false) --Iteration 9-- bool(false) bool(false) -bool(false) --Iteration 10-- bool(false) bool(false) -bool(false) --Iteration 11-- bool(false) bool(false) -bool(false) --Iteration 12-- bool(false) bool(false) -bool(false) --Iteration 13-- bool(false) bool(false) -bool(false) --Iteration 14-- bool(false) bool(false) -bool(false) --Iteration 15-- bool(false) bool(false) -bool(false) --Iteration 16-- bool(false) bool(false) -bool(false) --Iteration 17-- bool(false) bool(false) -bool(false) --Iteration 18-- bool(false) bool(false) -bool(false) --Iteration 19-- bool(false) bool(false) -bool(false) --Iteration 20-- bool(false) bool(false) -bool(false) --Iteration 21-- bool(false) bool(false) -bool(false) --Iteration 22-- bool(false) bool(false) -bool(false) --Iteration 23-- bool(false) bool(false) -bool(false) --Iteration 24-- bool(false) bool(false) -bool(false) --Iteration 25-- bool(false) bool(false) -bool(false) --Iteration 26-- bool(false) bool(false) -bool(false) --Iteration 27-- bool(false) bool(false) -bool(false) --Iteration 28-- bool(false) bool(false) -bool(false) --Iteration 29-- bool(false) bool(false) -bool(false) --Iteration 30-- bool(false) bool(false) -bool(false) --Iteration 31-- bool(false) bool(false) -bool(false) --Iteration 32-- bool(false) bool(false) -bool(false) --Iteration 33-- bool(false) bool(false) -bool(false) --Iteration 34-- bool(false) bool(false) -bool(false) --Iteration 35-- bool(false) bool(false) -bool(false) --Iteration 36-- bool(false) bool(false) -bool(false) --Iteration 37-- bool(false) bool(false) -bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Deprecated: Function is_real() is deprecated in %s on line %d - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Deprecated: Function is_real() is deprecated in %s on line %d - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_float_64bit.phpt b/ext/standard/tests/general_functions/is_float_64bit.phpt index be5843a7d5..4992bb51c4 100644 --- a/ext/standard/tests/general_functions/is_float_64bit.phpt +++ b/ext/standard/tests/general_functions/is_float_64bit.phpt @@ -1,5 +1,5 @@ --TEST-- -Test is_float() & it's FALIASes: is_double() & is_real() functions +Test is_float() & its is_double() alias --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); @@ -12,7 +12,7 @@ precision=14 * Description: Finds whether the given variable is a float */ -echo "*** Testing is_float(), is_double() and is_real() with float values***\n"; +echo "*** Testing is_float(), is_double() with float values***\n"; // different valid float values $floats = array( -2147483649, // float value @@ -46,17 +46,16 @@ $floats = array( .0034E-30, -.0034E-30 ); -/* loop to check that is_float(), is_double() & is_real() recognizes +/* loop to check that is_float(), is_double() recognizes different float values, expected: bool(true) */ $loop_counter = 1; foreach ($floats as $float ) { echo "-- Iteration $loop_counter --\n"; $loop_counter++; var_dump( is_float($float) ); var_dump( is_double($float) ); - var_dump( @is_real($float) ); } -echo "\n*** Testing is_float(), is_double() & is_real() with non float values ***\n"; +echo "\n*** Testing is_float(), is_double() with non float values ***\n"; // get a resource type variable $fp = fopen (__FILE__, "r"); $dfp = opendir ( __DIR__ ); @@ -119,323 +118,220 @@ $not_floats = array ( @$undefined_var ); /* loop through the $not_floats to see working of - is_float(), is_double() & is_real() on objects, + is_float(), is_double() on objects, arrays, boolean and others */ $loop_counter = 1; foreach ($not_floats as $value ) { echo "--Iteration $loop_counter--\n"; $loop_counter++; var_dump( is_float($value) ); var_dump( is_double($value) ); - var_dump( @is_real($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_float() ); -var_dump( is_double() ); -var_dump( is_real() ); - -//arguments more than expected -var_dump( is_float( $floats[0], $floats[1]) ); -var_dump( is_double( $floats[0], $floats[1]) ); -var_dump( is_real( $floats[0], $floats[1]) ); - echo "Done\n"; ?> ---EXPECTF-- -*** Testing is_float(), is_double() and is_real() with float values*** +--EXPECT-- +*** Testing is_float(), is_double() with float values*** -- Iteration 1 -- bool(false) bool(false) -bool(false) -- Iteration 2 -- bool(false) bool(false) -bool(false) -- Iteration 3 -- bool(false) bool(false) -bool(false) -- Iteration 4 -- bool(false) bool(false) -bool(false) -- Iteration 5 -- bool(false) bool(false) -bool(false) -- Iteration 6 -- bool(false) bool(false) -bool(false) -- Iteration 7 -- bool(true) bool(true) -bool(true) -- Iteration 8 -- bool(true) bool(true) -bool(true) -- Iteration 9 -- bool(true) bool(true) -bool(true) -- Iteration 10 -- bool(true) bool(true) -bool(true) -- Iteration 11 -- bool(true) bool(true) -bool(true) -- Iteration 12 -- bool(true) bool(true) -bool(true) -- Iteration 13 -- bool(true) bool(true) -bool(true) -- Iteration 14 -- bool(true) bool(true) -bool(true) -- Iteration 15 -- bool(true) bool(true) -bool(true) -- Iteration 16 -- bool(true) bool(true) -bool(true) -- Iteration 17 -- bool(true) bool(true) -bool(true) -- Iteration 18 -- bool(true) bool(true) -bool(true) -- Iteration 19 -- bool(true) bool(true) -bool(true) -- Iteration 20 -- bool(true) bool(true) -bool(true) -- Iteration 21 -- bool(true) bool(true) -bool(true) -- Iteration 22 -- bool(true) bool(true) -bool(true) -- Iteration 23 -- bool(true) bool(true) -bool(true) -- Iteration 24 -- bool(true) bool(true) -bool(true) -- Iteration 25 -- bool(true) bool(true) -bool(true) -- Iteration 26 -- bool(true) bool(true) -bool(true) -- Iteration 27 -- bool(true) bool(true) -bool(true) -- Iteration 28 -- bool(true) bool(true) -bool(true) -- Iteration 29 -- bool(true) bool(true) -bool(true) -- Iteration 30 -- bool(true) bool(true) -bool(true) -*** Testing is_float(), is_double() & is_real() with non float values *** +*** Testing is_float(), is_double() with non float values *** --Iteration 1-- bool(false) bool(false) -bool(false) --Iteration 2-- bool(false) bool(false) -bool(false) --Iteration 3-- bool(false) bool(false) -bool(false) --Iteration 4-- bool(false) bool(false) -bool(false) --Iteration 5-- bool(false) bool(false) -bool(false) --Iteration 6-- bool(false) bool(false) -bool(false) --Iteration 7-- bool(false) bool(false) -bool(false) --Iteration 8-- bool(false) bool(false) -bool(false) --Iteration 9-- bool(false) bool(false) -bool(false) --Iteration 10-- bool(false) bool(false) -bool(false) --Iteration 11-- bool(false) bool(false) -bool(false) --Iteration 12-- bool(false) bool(false) -bool(false) --Iteration 13-- bool(false) bool(false) -bool(false) --Iteration 14-- bool(false) bool(false) -bool(false) --Iteration 15-- bool(false) bool(false) -bool(false) --Iteration 16-- bool(false) bool(false) -bool(false) --Iteration 17-- bool(false) bool(false) -bool(false) --Iteration 18-- bool(false) bool(false) -bool(false) --Iteration 19-- bool(false) bool(false) -bool(false) --Iteration 20-- bool(false) bool(false) -bool(false) --Iteration 21-- bool(false) bool(false) -bool(false) --Iteration 22-- bool(false) bool(false) -bool(false) --Iteration 23-- bool(false) bool(false) -bool(false) --Iteration 24-- bool(false) bool(false) -bool(false) --Iteration 25-- bool(false) bool(false) -bool(false) --Iteration 26-- bool(false) bool(false) -bool(false) --Iteration 27-- bool(false) bool(false) -bool(false) --Iteration 28-- bool(false) bool(false) -bool(false) --Iteration 29-- bool(false) bool(false) -bool(false) --Iteration 30-- bool(false) bool(false) -bool(false) --Iteration 31-- bool(false) bool(false) -bool(false) --Iteration 32-- bool(false) bool(false) -bool(false) --Iteration 33-- bool(false) bool(false) -bool(false) --Iteration 34-- bool(false) bool(false) -bool(false) --Iteration 35-- bool(false) bool(false) -bool(false) --Iteration 36-- bool(false) bool(false) -bool(false) --Iteration 37-- bool(false) bool(false) -bool(false) - -*** Testing error conditions *** - -Warning: is_float() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Deprecated: Function is_real() is deprecated in %s on line %d - -Warning: is_real() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_float() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_double() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Deprecated: Function is_real() is deprecated in %s on line %d - -Warning: is_real() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int.phpt b/ext/standard/tests/general_functions/is_int.phpt index 4cfbf653be..25e6c2564e 100644 --- a/ext/standard/tests/general_functions/is_int.phpt +++ b/ext/standard/tests/general_functions/is_int.phpt @@ -132,17 +132,6 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; // close the resources @@ -442,24 +431,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_int_64bit.phpt b/ext/standard/tests/general_functions/is_int_64bit.phpt index dabc7be705..8e5e9332c0 100644 --- a/ext/standard/tests/general_functions/is_int_64bit.phpt +++ b/ext/standard/tests/general_functions/is_int_64bit.phpt @@ -134,20 +134,9 @@ foreach ($not_int_types as $type ) { var_dump( is_long($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_int() ); -var_dump( is_integer() ); -var_dump( is_long() ); - -//arguments more than expected -var_dump( is_int(TRUE, FALSE) ); -var_dump( is_integer(TRUE, FALSE) ); -var_dump( is_long(TRUE, FALSE) ); - echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing is_int(), is_integer() & is_long() with valid integer values *** --Iteration 1-- bool(true) @@ -439,24 +428,4 @@ bool(false) bool(false) bool(false) bool(false) - -*** Testing error conditions *** - -Warning: is_int() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_int() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_integer() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: is_long() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_null.phpt b/ext/standard/tests/general_functions/is_null.phpt index 9082f5fcd1..6560707e57 100644 --- a/ext/standard/tests/general_functions/is_null.phpt +++ b/ext/standard/tests/general_functions/is_null.phpt @@ -127,13 +127,6 @@ foreach ($not_null_types as $type ) { var_dump( is_null($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_null() ); - -//arguments more than expected -var_dump( is_null(NULL, null) ); - echo "Done\n"; // close the resources used @@ -141,7 +134,7 @@ fclose($fp); closedir($dfp); ?> ---EXPECTF-- +--EXPECT-- *** Testing is_null() with valid null values *** -- Iteration 1 -- bool(true) @@ -285,12 +278,4 @@ bool(false) bool(false) -- Iteration 59 -- bool(false) - -*** Testing error conditions *** - -Warning: is_null() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_null() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_numeric.phpt b/ext/standard/tests/general_functions/is_numeric.phpt index c23e5e3b8c..8883c57ac2 100644 --- a/ext/standard/tests/general_functions/is_numeric.phpt +++ b/ext/standard/tests/general_functions/is_numeric.phpt @@ -145,13 +145,6 @@ foreach ($not_numerics as $type ) { var_dump( is_numeric($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_numeric() ); - -//arguments more than expected -var_dump( is_numeric("10", "20") ); - echo "Done\n"; // close the resources used @@ -159,7 +152,7 @@ fclose($fp); closedir($dfp); ?> ---EXPECTF-- +--EXPECT-- *** Testing is_numeric() with valid numeric values *** -- Iteration 1 -- bool(true) @@ -373,12 +366,4 @@ bool(false) bool(false) -- Iteration 29 -- bool(false) - -*** Testing error conditions *** - -Warning: is_numeric() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_numeric() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_object.phpt b/ext/standard/tests/general_functions/is_object.phpt index 96c515bf65..8a5ac1bcbe 100644 --- a/ext/standard/tests/general_functions/is_object.phpt +++ b/ext/standard/tests/general_functions/is_object.phpt @@ -138,13 +138,6 @@ foreach ($not_objects as $type ) { var_dump( is_object($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_object() ); - -//arguments more than expected -var_dump( is_object($myClass_object, $myClass_object) ); - echo "Done\n"; // close the resources used @@ -152,7 +145,7 @@ fclose($fp); closedir($dfp); ?> ---EXPECTF-- +--EXPECT-- *** Testing is_object() with valid objects *** -- Iteration 1 -- bool(true) @@ -216,12 +209,4 @@ bool(false) bool(false) -- Iteration 19 -- bool(false) - -*** Testing error conditions *** - -Warning: is_object() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_object() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/is_resource.phpt b/ext/standard/tests/general_functions/is_resource.phpt index 2717e3fa43..ff6f1fd422 100644 --- a/ext/standard/tests/general_functions/is_resource.phpt +++ b/ext/standard/tests/general_functions/is_resource.phpt @@ -2,9 +2,9 @@ Bug #27822 (is_resource() returns TRUE for closed resources) --FILE-- <?php - $f = fopen(__FILE__, 'r'); - fclose($f); - var_dump(is_resource($f)); + $f = fopen(__FILE__, 'r'); + fclose($f); + var_dump(is_resource($f)); ?> --EXPECT-- bool(false) diff --git a/ext/standard/tests/general_functions/is_resource_basic.phpt b/ext/standard/tests/general_functions/is_resource_basic.phpt index 75f4e4a8d8..06988850ee 100644 --- a/ext/standard/tests/general_functions/is_resource_basic.phpt +++ b/ext/standard/tests/general_functions/is_resource_basic.phpt @@ -11,39 +11,39 @@ echo "*** Testing is_resource() : basic functionality ***\n"; class Hello { public function SayHello($arg) { - echo "Hello\n"; + echo "Hello\n"; } } $vars = array( - false, - true, - 10, - 10.5, - "Helo World", - array(1,2,3,4,5), - NULL, - new Hello()); + false, + true, + 10, + 10.5, + "Helo World", + array(1,2,3,4,5), + NULL, + new Hello()); $types = array( - "bool=false", - "bool=true", - "integer", - "double", - "string", - "array", - "NULL", - "object"); + "bool=false", + "bool=true", + "integer", + "double", + "string", + "array", + "NULL", + "object"); echo "\nNon-resource type cases\n"; for ($i=0; $i < count($vars); $i++) { - if (is_resource($vars[$i])) { - echo $types[$i]. " test returns TRUE\n"; - } else { - echo $types[$i]. " test returns FALSE\n"; - } + if (is_resource($vars[$i])) { + echo $types[$i]. " test returns TRUE\n"; + } else { + echo $types[$i]. " test returns FALSE\n"; + } } $res = fopen(__FILE__, "r"); @@ -51,9 +51,9 @@ echo "\nResource type..var_dump after file open returns\n"; var_dump($res); echo "Resource type..after file open is_resource() returns"; if (is_resource($res)) { - echo " TRUE\n"; + echo " TRUE\n"; } else { - echo " FALSE\n"; + echo " FALSE\n"; } fclose($res); @@ -61,14 +61,13 @@ echo "\nResource type..var_dump after file close returns\n"; var_dump($res); echo "Resource type..after file close is_resource() returns"; if (is_resource($res)) { - echo " TRUE\n"; + echo " TRUE\n"; } else { - echo " FALSE\n"; + echo " FALSE\n"; } ?> -===DONE=== --EXPECTF-- *** Testing is_resource() : basic functionality *** @@ -89,4 +88,3 @@ Resource type..after file open is_resource() returns TRUE Resource type..var_dump after file close returns resource(%d) of type (Unknown) Resource type..after file close is_resource() returns FALSE -===DONE=== diff --git a/ext/standard/tests/general_functions/is_scalar.phpt b/ext/standard/tests/general_functions/is_scalar.phpt index 53620178c4..6a89da9f56 100644 --- a/ext/standard/tests/general_functions/is_scalar.phpt +++ b/ext/standard/tests/general_functions/is_scalar.phpt @@ -105,14 +105,6 @@ foreach( $variation_array as $value ) { var_dump( is_scalar($value) ); } -echo "\n*** Testing error conditions ***\n"; -// Zero arguments -var_dump( is_scalar() ); - -// Arguments more than expected -var_dump( is_scalar( $scalar_variables[2], $scalar_variables[2]) ); -var_dump( is_scalar( new stdclass, new stdclass) ); - echo "Done\n"; // close the resources used @@ -120,7 +112,7 @@ fclose($fp); closedir($dfp); ?> ---EXPECTF-- +--EXPECT-- *** Testing basic operations *** -- Iteration 1 -- bool(true) @@ -226,15 +218,4 @@ bool(false) bool(false) -- Iteration 18 -- bool(false) - -*** Testing error conditions *** - -Warning: is_scalar() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: is_scalar() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/is_string.phpt b/ext/standard/tests/general_functions/is_string.phpt index ea2fb36a24..a4ef7a47b1 100644 --- a/ext/standard/tests/general_functions/is_string.phpt +++ b/ext/standard/tests/general_functions/is_string.phpt @@ -17,7 +17,7 @@ EOT; /* heredoc string with only numerics */ $heredoc_numeric_string = <<<EOT 123456 3993 -4849 string +4849 string EOT; /* null heardoc string */ $heredoc_empty_string = <<<EOT @@ -140,13 +140,6 @@ foreach ($not_strings as $type ) { var_dump( is_string($type) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( is_string() ); - -//arguments more than expected -var_dump( is_string("string", "test") ); - echo "Done\n"; // close the resources used @@ -154,7 +147,7 @@ fclose($fp); closedir($dfp); ?> ---EXPECTF-- +--EXPECT-- *** Testing is_string() with valid string values *** -- Iteration 1 -- bool(true) @@ -292,12 +285,4 @@ bool(false) bool(false) -- Iteration 45 -- bool(false) - -*** Testing error conditions *** - -Warning: is_string() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: is_string() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) Done diff --git a/ext/standard/tests/general_functions/isset_basic1.phpt b/ext/standard/tests/general_functions/isset_basic1.phpt index bdaf1eb46d..7990810467 100644 --- a/ext/standard/tests/general_functions/isset_basic1.phpt +++ b/ext/standard/tests/general_functions/isset_basic1.phpt @@ -40,7 +40,6 @@ echo "Null test: " . (isset($n) ? "YES": "NO") . "\n"; echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n"; echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n"; ?> -===DONE=== --EXPECT-- *** Testing isset() : basic functionality *** Integer test: YES @@ -63,4 +62,3 @@ Boolean test: NO Null test: NO Object test: NO Resource test: NO -===DONE=== diff --git a/ext/standard/tests/general_functions/isset_basic2.phpt b/ext/standard/tests/general_functions/isset_basic2.phpt index 925b19a2c0..586203d4ee 100644 --- a/ext/standard/tests/general_functions/isset_basic2.phpt +++ b/ext/standard/tests/general_functions/isset_basic2.phpt @@ -38,7 +38,6 @@ var_dump(isset($var[1])); var_dump(isset($var, $var[1])); ?> -===DONE=== --EXPECT-- *** Testing isset() : basic functionality *** Test multiple scalar variables in a group @@ -57,4 +56,3 @@ bool(false) bool(true) bool(true) bool(true) -===DONE=== diff --git a/ext/standard/tests/general_functions/ob_get_flush_basic.phpt b/ext/standard/tests/general_functions/ob_get_flush_basic.phpt index 1c62340970..b724b3c91c 100644 --- a/ext/standard/tests/general_functions/ob_get_flush_basic.phpt +++ b/ext/standard/tests/general_functions/ob_get_flush_basic.phpt @@ -27,7 +27,6 @@ $string = ob_get_flush(); var_dump($string) ?> -===DONE=== --EXPECT-- *** Testing ob_get_flush() : basic functionality *** testing ob_get_flush() with some @@ -39,4 +38,3 @@ Newlines too array(0) { } string(0) "" -===DONE=== diff --git a/ext/standard/tests/general_functions/ob_get_flush_error.phpt b/ext/standard/tests/general_functions/ob_get_flush_error.phpt index 0664043eba..c45e810841 100644 --- a/ext/standard/tests/general_functions/ob_get_flush_error.phpt +++ b/ext/standard/tests/general_functions/ob_get_flush_error.phpt @@ -12,21 +12,12 @@ output_buffering=0 echo "*** Testing ob_get_flush() : error conditions ***\n"; -// One extra argument -$extra_arg = 10; -var_dump( ob_get_flush( $extra_arg ) ); - // No ob_start() executed var_dump( ob_get_flush() ); ?> -===DONE=== --EXPECTF-- *** Testing ob_get_flush() : error conditions *** -Warning: ob_get_flush() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Notice: ob_get_flush(): failed to delete and flush buffer. No buffer to delete or flush in %s on line %d +Notice: ob_get_flush(): Failed to delete and flush buffer. No buffer to delete or flush in %s on line %d bool(false) -===DONE=== diff --git a/ext/standard/tests/general_functions/ob_get_length_basic.phpt b/ext/standard/tests/general_functions/ob_get_length_basic.phpt index b3470bec55..0eb1adf9ee 100644 --- a/ext/standard/tests/general_functions/ob_get_length_basic.phpt +++ b/ext/standard/tests/general_functions/ob_get_length_basic.phpt @@ -12,11 +12,11 @@ output_buffering=0 function dump_string_length( $string ) { - ob_start(); - echo $string; - $len = ob_get_length(); - ob_end_clean(); - var_dump( $len ); + ob_start(); + echo $string; + $len = ob_get_length(); + ob_end_clean(); + var_dump( $len ); } echo "*** Testing ob_get_length() : basic functionality ***\n"; @@ -31,12 +31,8 @@ dump_string_length( ' lsf' ); dump_string_length( '' ); dump_string_length( null ); -// Extra argument -var_dump( ob_get_length( 'foobar' ) ); - ?> -===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing ob_get_length() : basic functionality *** bool(false) int(26) @@ -45,7 +41,3 @@ int(1) int(15) int(0) int(0) - -Warning: ob_get_length() expects exactly 0 parameters, 1 given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/general_functions/ob_start_closures.phpt b/ext/standard/tests/general_functions/ob_start_closures.phpt index ba730961bd..c4b5fcc50d 100644 --- a/ext/standard/tests/general_functions/ob_start_closures.phpt +++ b/ext/standard/tests/general_functions/ob_start_closures.phpt @@ -27,7 +27,6 @@ ob_end_flush(); echo $str1, $str2; ?> -===DONE=== --EXPECT-- *** Testing ob_start() : closures as output handlers *** Output (1): Output (2): Test @@ -36,4 +35,3 @@ Test With newlines Output (2): Test With newlines -===DONE=== diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt index 58b6f19f5c..980ae129ef 100644 --- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt +++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic1.phpt @@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form=" url_rewriter.tags="a=href,area=href,frame=src,form=" --FILE-- <?php - ob_start(); + ob_start(); // Common setting ini_set('url_rewriter.hosts', 'php.net,www.php.net'); ini_set('session.trans_sid_hosts', 'php.net,www.php.net'); diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt index 6b0c4e85a9..e888932a60 100644 --- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt +++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic2.phpt @@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form=" url_rewriter.tags="a=href,area=href,frame=src,form=" --FILE-- <?php - ob_start(); + ob_start(); // Common setting ini_set('url_rewriter.hosts', 'php.net,www.php.net'); ini_set('session.trans_sid_hosts', 'php.net,www.php.net'); diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt index 9e35f967f0..0cf10f7249 100644 --- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt +++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic3.phpt @@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form=" url_rewriter.tags="a=href,area=href,frame=src,form=" --FILE-- <?php - ob_start(); + ob_start(); // Common setting ini_set('url_rewriter.hosts', 'example.com'); ini_set('session.use_only_cookies', 0); diff --git a/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt b/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt index 2dda4e7896..332f7cfdc2 100644 --- a/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt +++ b/ext/standard/tests/general_functions/output_add_rewrite_var_basic4.phpt @@ -7,7 +7,7 @@ session.trans_sid_tags="a=href,area=href,frame=src,form=" url_rewriter.tags="a=href,area=href,frame=src,form=" --FILE-- <?php - ob_start(); + ob_start(); // Common setting ini_set('url_rewriter.hosts', 'example.com'); ini_set('session.use_only_cookies', 1); diff --git a/ext/standard/tests/general_functions/parse_ini_file.phpt b/ext/standard/tests/general_functions/parse_ini_file.phpt index 368d262a6e..8b0db68a54 100644 --- a/ext/standard/tests/general_functions/parse_ini_file.phpt +++ b/ext/standard/tests/general_functions/parse_ini_file.phpt @@ -8,8 +8,6 @@ parse_ini_file() multiple calls $filename = __DIR__."/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)); @@ -121,16 +119,10 @@ var_dump(parse_ini_file($filename, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_file() expects at least 1 parameter, 0 given in %sparse_ini_file.php on line 6 +Warning: parse_ini_file(%sparse_ini_file.dat): Failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) -Warning: parse_ini_file() expects at most 3 parameters, 4 given in %sparse_ini_file.php on line 7 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 8 -bool(false) - -Warning: parse_ini_file(%sparse_ini_file.dat): failed to open stream: No such file or directory in %sparse_ini_file.php on line 9 +Warning: parse_ini_file(%sparse_ini_file.dat): Failed to open stream: No such file or directory in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> @@ -138,11 +130,11 @@ array(1) { } Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 20 + in %sparse_ini_file.php on line %d bool(false) Warning: syntax error, unexpected '='%sparse_ini_file.dat on line 2 - in %sparse_ini_file.php on line 26 + in %sparse_ini_file.php on line %d bool(false) array(1) { ["test"]=> diff --git a/ext/standard/tests/general_functions/parse_ini_string_001.phpt b/ext/standard/tests/general_functions/parse_ini_string_001.phpt index 1621fe9f16..de1daa7637 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_001.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_001.phpt @@ -23,7 +23,7 @@ PHP_CONSTANT = 1.2345678 HELLO = HELLO [date] -date = +date = time = [paths] @@ -62,7 +62,7 @@ Non_alpha11 = / Non_alpha12 = \ ;These chars have a special meaning when used in the value, ; hence parser throws an error -;Non_alpha13 = & +;Non_alpha13 = & ;Non_alpha14 = ^ ;Non_alpha15 = {} ;Non_alpha16 = | @@ -170,7 +170,7 @@ Key16 = Null Key17 = nuLL Key18 = null -[ReservedKeys_as_Keys] +[ReservedKeys_as_Keys] ; Expected:error, reserved key words must not be used as keys for ini file ;YES = 1 ;Yes = 2 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 106cd0c842..384398cdb2 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_002.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_002.phpt @@ -3,9 +3,6 @@ parse_ini_string() multiple calls --FILE-- <?php -var_dump(parse_ini_string()); -var_dump(parse_ini_string(1,1,1,1)); - $ini = " test = "; @@ -87,11 +84,6 @@ var_dump(parse_ini_string($ini, true)); echo "Done\n"; ?> --EXPECTF-- -Warning: parse_ini_string() expects at least 1 parameter, 0 given in %s -bool(false) - -Warning: parse_ini_string() expects at most 3 parameters, 4 given in %s -bool(false) array(1) { ["test"]=> string(0) "" diff --git a/ext/standard/tests/general_functions/parse_ini_string_bug76068.phpt b/ext/standard/tests/general_functions/parse_ini_string_bug76068.phpt index 8362fb84d1..359e9c3446 100644 --- a/ext/standard/tests/general_functions/parse_ini_string_bug76068.phpt +++ b/ext/standard/tests/general_functions/parse_ini_string_bug76068.phpt @@ -16,7 +16,6 @@ $s = parse_ini_string("[foo]\nbar=42|>baz",true, \INI_SCANNER_TYPED); var_dump($s); ?> -==DONE== --EXPECT-- array(1) { ["foo"]=> @@ -46,4 +45,3 @@ array(1) { string(2) "42" } } -==DONE== diff --git a/ext/standard/tests/general_functions/php_uname_basic.phpt b/ext/standard/tests/general_functions/php_uname_basic.phpt index 629318d725..b4fb78e6ea 100644 --- a/ext/standard/tests/general_functions/php_uname_basic.phpt +++ b/ext/standard/tests/general_functions/php_uname_basic.phpt @@ -20,7 +20,6 @@ var_dump(php_uname('v')); var_dump(php_uname('m')); ?> -===DONE=== --EXPECTF-- *** Testing php_uname() - basic test string(%d) "%s" @@ -32,4 +31,3 @@ string(%d) "%s" string(%d) "%s" string(%d) "%s" string(%d) "%s" -===DONE=== diff --git a/ext/standard/tests/general_functions/php_uname_error.phpt b/ext/standard/tests/general_functions/php_uname_error.phpt index 392e1c930e..c64c15b404 100644 --- a/ext/standard/tests/general_functions/php_uname_error.phpt +++ b/ext/standard/tests/general_functions/php_uname_error.phpt @@ -8,49 +8,13 @@ Test php_uname() function - error conditions - pass function incorrect argument echo "*** Testing php_uname() - error test\n"; -echo "\n-- Testing php_uname() function with more than expected no. of arguments --\n"; -var_dump( php_uname('a', true) ); - echo "\n-- Testing php_uname() function with invalid mode --\n"; // am invalid mode should result in same o/p as mode 'a' var_dump( php_uname('z') == php_uname('z') ); -class barClass { -} - -$fp = fopen(__FILE__, "r"); - -echo "\n-- Testing php_uname() function with invalid argument types --\n"; -var_dump(php_uname(array())); -var_dump(php_uname(array('color' => 'red', 'item' => 'pen'))); -var_dump(php_uname(new barClass())); -var_dump(php_uname($fp)); - -fclose($fp); ?> -===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing php_uname() - error test --- Testing php_uname() function with more than expected no. of arguments -- - -Warning: php_uname() expects at most 1 parameter, 2 given in %s on line %d -NULL - -- Testing php_uname() function with invalid mode -- bool(true) - --- Testing php_uname() function with invalid argument types -- - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, array given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, object given in %s on line %d -NULL - -Warning: php_uname() expects parameter 1 to be string, resource given in %s on line %d -NULL -===DONE=== diff --git a/ext/standard/tests/general_functions/phpcredits.phpt b/ext/standard/tests/general_functions/phpcredits.phpt index 044232570e..dfcddc61f3 100644 --- a/ext/standard/tests/general_functions/phpcredits.phpt +++ b/ext/standard/tests/general_functions/phpcredits.phpt @@ -4,7 +4,6 @@ phpcredits() <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -40,9 +39,6 @@ PHP Quality Assurance Team %wWebsites and Infrastructure team%w %a bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits.php on line 4 -NULL -- PHP Credits bool(true) diff --git a/ext/standard/tests/general_functions/phpcredits2.phpt b/ext/standard/tests/general_functions/phpcredits2.phpt index 9966f23a96..6aa023e919 100644 --- a/ext/standard/tests/general_functions/phpcredits2.phpt +++ b/ext/standard/tests/general_functions/phpcredits2.phpt @@ -6,7 +6,6 @@ dummy=x <?php var_dump(phpcredits()); -var_dump(phpcredits(array())); echo "--\n"; var_dump(phpcredits(0)); @@ -18,9 +17,6 @@ var_dump(phpcredits(CREDITS_GROUP)); --EXPECTF-- <!DOCTYPE %a>%s</html> bool(true) - -Warning: phpcredits() expects parameter 1 to be int, array given in %sphpcredits2.php on line 4 -NULL -- <h1>PHP Credits</h1> bool(true) diff --git a/ext/standard/tests/general_functions/phpinfo.phpt b/ext/standard/tests/general_functions/phpinfo.phpt index a805876aab..5f4d99ffba 100644 --- a/ext/standard/tests/general_functions/phpinfo.phpt +++ b/ext/standard/tests/general_functions/phpinfo.phpt @@ -5,9 +5,6 @@ phpinfo() var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -62,10 +59,6 @@ PHP License %A bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo.php on line 5 -NULL --- phpinfo() bool(true) -- diff --git a/ext/standard/tests/general_functions/phpinfo2.phpt b/ext/standard/tests/general_functions/phpinfo2.phpt index f422f923d9..5a36aa9d28 100644 --- a/ext/standard/tests/general_functions/phpinfo2.phpt +++ b/ext/standard/tests/general_functions/phpinfo2.phpt @@ -7,9 +7,6 @@ dummy=x var_dump(phpinfo()); echo "--\n"; -var_dump(phpinfo(array())); - -echo "--\n"; var_dump(phpinfo(0)); echo "--\n"; @@ -20,10 +17,6 @@ var_dump(phpinfo(INFO_LICENSE)); <!DOCTYPE %s> %a</html>bool(true) -- - -Warning: phpinfo() expects parameter 1 to be int, array given in %sphpinfo2.php on line 5 -NULL --- <!DOCTYPE %s> %a</html>bool(true) -- diff --git a/ext/standard/tests/general_functions/print_r.phpt b/ext/standard/tests/general_functions/print_r.phpt index bcf5231144..d2ec63f5b4 100644 --- a/ext/standard/tests/general_functions/print_r.phpt +++ b/ext/standard/tests/general_functions/print_r.phpt @@ -101,7 +101,7 @@ $strings = array ( 'PHP', "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL - "1234\t\n5678\n\t9100\rabcda" // strings with escape characters + "1234\t\n5678\n\t9100\"abcda" // strings with escape characters ); /* calling check_printr() to display contents of strings using print_r() */ check_printr($strings); @@ -240,8 +240,8 @@ $resources = array ( using print_r() */ check_printr($resources); -echo "\n*** Testing print_r() on different combinations of scalar - and non-scalar variables ***\n"; +echo "\n*** Testing print_r() on different combinations of scalar + and non-scalar variables ***\n"; /* a variable which is unset */ $unset_var = 10.5; unset($unset_var); @@ -261,40 +261,22 @@ $variations = array ( non-scalar variables using print_r() */ check_printr($variations); -echo "\n*** Testing print_r() on miscelleneous input arguments ***\n"; +echo "\n*** Testing print_r() on miscellaneous input arguments ***\n"; $misc_values = array ( @$unset_var, NULL, // NULL argument @$undef_variable, //undefined variable null ); -/* calling check_printr() to display miscelleneous data using print_r() */ +/* calling check_printr() to display miscellaneous data using print_r() */ check_printr($misc_values); -/* checking print_r() on functions */ -echo "\n*** Testing print_r() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -print_r( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing print_r() on integer variables *** -- Iteration 1 -- @@ -622,13 +604,13 @@ abcd -- Iteration 14 -- 1234 5678 - 9100
abcda + 9100"abcda 1234 5678 - 9100
abcda + 9100"abcda 1234 5678 - 9100
abcda + 9100"abcda *** Testing print_r() on boolean variables *** -- Iteration 1 -- @@ -1480,15 +1462,15 @@ object_class Object *** Testing print_r() on resources *** -- Iteration 1 -- -Resource id #%d -Resource id #%d -Resource id #%d +Resource id #5 +Resource id #5 +Resource id #5 -- Iteration 2 -- -Resource id #%d -Resource id #%d -Resource id #%d -*** Testing print_r() on different combinations of scalar - and non-scalar variables *** +Resource id #6 +Resource id #6 +Resource id #6 +*** Testing print_r() on different combinations of scalar + and non-scalar variables *** -- Iteration 1 -- Array @@ -1697,7 +1679,7 @@ Array [3] => /00\7 ) -*** Testing print_r() on miscelleneous input arguments *** +*** Testing print_r() on miscellaneous input arguments *** -- Iteration 1 -- @@ -1714,23 +1696,4 @@ Array -- Iteration 4 -- - -*** Testing print_r() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -2 * 3 = 6 -Deprecated: Function create_function() is deprecated in %s on line %d - - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/print_r_64bit.phpt b/ext/standard/tests/general_functions/print_r_64bit.phpt index 8584f08758..5df1637dbd 100644 --- a/ext/standard/tests/general_functions/print_r_64bit.phpt +++ b/ext/standard/tests/general_functions/print_r_64bit.phpt @@ -105,7 +105,7 @@ $strings = array ( 'PHP', "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL - "1234\t\n5678\n\t9100\rabcda" // strings with escape characters + "1234\t\n5678\n\t9100\"abcda" // strings with escape characters ); /* calling check_printr() to display contents of strings using print_r() */ check_printr($strings); @@ -244,8 +244,8 @@ $resources = array ( using print_r() */ check_printr($resources); -echo "\n*** Testing print_r() on different combinations of scalar - and non-scalar variables ***\n"; +echo "\n*** Testing print_r() on different combinations of scalar + and non-scalar variables ***\n"; /* a variable which is unset */ $unset_var = 10.5; unset($unset_var); @@ -265,40 +265,22 @@ $variations = array ( non-scalar variables using print_r() */ check_printr($variations); -echo "\n*** Testing print_r() on miscelleneous input arguments ***\n"; +echo "\n*** Testing print_r() on miscellaneous input arguments ***\n"; $misc_values = array ( @$unset_var, NULL, // NULL argument @$undef_variable, //undefined variable null ); -/* calling check_printr() to display miscelleneous data using print_r() */ +/* calling check_printr() to display miscellaneous data using print_r() */ check_printr($misc_values); -/* checking print_r() on functions */ -echo "\n*** Testing print_r() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -print_r( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -print_r( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump( print_r() ); - -//passing more than required no. of arguments -var_dump( print_r(123, true, "abc") ); - -// check when second arg is given other than boolean TRUE -var_dump( print_r ($value, "string") ); - /* closing resource handle used */ closedir($dir_handle); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing print_r() on integer variables *** -- Iteration 1 -- @@ -626,13 +608,13 @@ abcd -- Iteration 14 -- 1234 5678 - 9100
abcda + 9100"abcda 1234 5678 - 9100
abcda + 9100"abcda 1234 5678 - 9100
abcda + 9100"abcda *** Testing print_r() on boolean variables *** -- Iteration 1 -- @@ -1491,8 +1473,8 @@ Resource id #5 Resource id #6 Resource id #6 Resource id #6 -*** Testing print_r() on different combinations of scalar - and non-scalar variables *** +*** Testing print_r() on different combinations of scalar + and non-scalar variables *** -- Iteration 1 -- Array @@ -1701,7 +1683,7 @@ Array [3] => /00\7 ) -*** Testing print_r() on miscelleneous input arguments *** +*** Testing print_r() on miscellaneous input arguments *** -- Iteration 1 -- @@ -1718,23 +1700,4 @@ Array -- Iteration 4 -- - -*** Testing print_r() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -2 * 3 = 6 -Deprecated: Function create_function() is deprecated in %s on line %d - - -*** Testing error conditions *** - -Warning: print_r() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: print_r() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - -Notice: Undefined variable: value in %s on line %d -string(0) "" Done diff --git a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt index 87a4545501..6bf3b2c0a6 100644 --- a/ext/standard/tests/general_functions/proc_nice_basic-win.phpt +++ b/ext/standard/tests/general_functions/proc_nice_basic-win.phpt @@ -8,10 +8,6 @@ if (!defined('PHP_WINDOWS_VERSION_MAJOR')) { die('skip: Only for Windows'); } -if (PHP_SAPI != 'cli') { - die('skip: Only for CLI'); -} - if (getenv('SKIP_SLOW_TESTS')) { doe('skip: Slow test'); } @@ -19,71 +15,71 @@ if (getenv('SKIP_SLOW_TESTS')) { --FILE-- <?php function get_priority_from_wmic() { - static $bin, $pid; + static $bin, $pid; - if (!$bin) { - $t = explode('\\', PHP_BINARY); + if (!$bin) { + $t = explode('\\', PHP_BINARY); - $bin = end($t); - $pid = getmypid(); - } + $bin = end($t); + $pid = getmypid(); + } - $t = ''; - $p = popen('wmic process where name="' . $bin . '"', 'r'); + $t = ''; + $p = popen('wmic process where name="' . $bin . '"', 'r'); - if (!$p) { - return false; - } + if (!$p) { + return false; + } - while(!feof($p)) { - $t .= fread($p, 1024); - } + while(!feof($p)) { + $t .= fread($p, 1024); + } - pclose($p); + pclose($p); - $t = explode(PHP_EOL, $t); + $t = explode(PHP_EOL, $t); - $f = false; - $m = [ - strpos($t[0], ' ProcessId' ), - strpos($t[0], ' Priority ') - ]; + $f = false; + $m = [ + strpos($t[0], ' ProcessId' ), + strpos($t[0], ' Priority ') + ]; - foreach ($t as $n => $l) { - if (!$n || empty($l)) { - continue; - } + foreach ($t as $n => $l) { + if (!$n || empty($l)) { + continue; + } - $d = []; + $d = []; - foreach ($m as $c) { - $d[] = (int) substr($l, $c + 1, strpos($l, ' ', $c + 2) - ($c + 1)); - } + foreach ($m as $c) { + $d[] = (int) substr($l, $c + 1, strpos($l, ' ', $c + 2) - ($c + 1)); + } - if ($d[0] === $pid) { - return $d[1]; - } - } + if ($d[0] === $pid) { + return $d[1]; + } + } - return false; + return false; } $p = [ - /* '<verbose name>' => ['<wmic value>', '<proc_nice value>'] */ + /* '<verbose name>' => ['<wmic value>', '<proc_nice value>'] */ - 'Idle' => [4, 10], - 'Below normal' => [6, 5], - 'Normal' => [8, 0], - 'Above normal' => [10, -5], - 'High priority' => [13, -10] - ]; + 'Idle' => [4, 10], + 'Below normal' => [6, 5], + 'Normal' => [8, 0], + 'Above normal' => [10, -5], + 'High priority' => [13, -10] + ]; foreach ($p as $test => $data) { - printf('Testing \'%s\' (%d): ', $test, $data[1]); + printf('Testing \'%s\' (%d): ', $test, $data[1]); - proc_nice($data[1]); + proc_nice($data[1]); - print (($wp = get_priority_from_wmic()) === $data[0] ? 'Passed' : 'Failed (' . $wp . ')') . PHP_EOL; + print (($wp = get_priority_from_wmic()) === $data[0] ? 'Passed' : 'Failed (' . $wp . ')') . PHP_EOL; } ?> --EXPECT-- diff --git a/ext/standard/tests/general_functions/proc_nice_basic.phpt b/ext/standard/tests/general_functions/proc_nice_basic.phpt index d14a5f62a9..687152ee10 100644 --- a/ext/standard/tests/general_functions/proc_nice_basic.phpt +++ b/ext/standard/tests/general_functions/proc_nice_basic.phpt @@ -12,21 +12,21 @@ if(substr(strtoupper(PHP_OS), 0, 3) == 'WIN') die('skip. not for Windows'); ?> --FILE-- <?php - function getNice($id) - { - $res = shell_exec('ps -p ' . $id .' -o "pid,nice"'); - preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches); - if (count($matches) > 2) - return $matches[2]; - else - return -1; - } - $delta = 10; - $pid = getmypid(); - $niceBefore = getNice($pid); - proc_nice($delta); - $niceAfter = getNice($pid); - var_dump($niceBefore == ($niceAfter - $delta)); + function getNice($id) + { + $res = shell_exec('ps -p ' . $id .' -o "pid,nice"'); + preg_match('/^\s*\w+\s+\w+\s*(\d+)\s+(\d+)/m', $res, $matches); + if (count($matches) > 2) + return $matches[2]; + else + return -1; + } + $delta = 10; + $pid = getmypid(); + $niceBefore = getNice($pid); + proc_nice($delta); + $niceAfter = getNice($pid); + var_dump($niceBefore == ($niceAfter - $delta)); ?> --EXPECT-- bool(true) diff --git a/ext/standard/tests/general_functions/proc_open-mb0.phpt b/ext/standard/tests/general_functions/proc_open-mb0.phpt index 4ff38267ad..c97ebda970 100644 --- a/ext/standard/tests/general_functions/proc_open-mb0.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb0.phpt @@ -2,7 +2,6 @@ proc_open with bypass_shell subprocess parameter passing --SKIPIF-- <?php -if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> --FILE-- @@ -14,24 +13,24 @@ $f = __DIR__ . DIRECTORY_SEPARATOR . "proc_only_mb0.php"; file_put_contents($f,'<?php var_dump($argv); ?>'); $ds = array( - 0 => array("pipe", "r"), - 1 => array("pipe", "w"), - 2 => array("pipe", "w") - ); + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w") + ); $p = proc_open( - "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба", - $ds, - $pipes, - NULL, - NULL, - array("bypass_shell" => true) - ); + "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба", + $ds, + $pipes, + NULL, + NULL, + array("bypass_shell" => true) + ); $out = ""; while (!feof($pipes[1])) { - $out .= fread($pipes[1], 1024); + $out .= fread($pipes[1], 1024); } proc_close($p); @@ -39,7 +38,6 @@ proc_close($p); echo $out; ?> -==DONE== --EXPECTF-- array(4) { [0]=> @@ -51,4 +49,3 @@ array(4) { [3]=> string(14) "карамба" } -==DONE== diff --git a/ext/standard/tests/general_functions/proc_open-mb1.phpt b/ext/standard/tests/general_functions/proc_open-mb1.phpt index e7a7a4cbfc..8a735cf306 100644 --- a/ext/standard/tests/general_functions/proc_open-mb1.phpt +++ b/ext/standard/tests/general_functions/proc_open-mb1.phpt @@ -2,7 +2,6 @@ proc_open without bypass_shell subprocess parameter passing --SKIPIF-- <?php -if (php_sapi_name() != "cli") die('skip CLI only test'); if (!function_exists("proc_open")) echo "skip proc_open() is not available"; ?> --FILE-- @@ -14,21 +13,21 @@ $f = __DIR__ . DIRECTORY_SEPARATOR . "proc_only_mb1.php"; file_put_contents($f,'<?php var_dump($argv); ?>'); $ds = array( - 0 => array("pipe", "r"), - 1 => array("pipe", "w"), - 2 => array("pipe", "w") - ); + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w") + ); $p = proc_open( - "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба", - $ds, - $pipes - ); + "$php -n $f テストマルãƒãƒã‚¤ãƒˆãƒ»ãƒ‘ス füße карамба", + $ds, + $pipes + ); $out = ""; while (!feof($pipes[1])) { - $out .= fread($pipes[1], 1024); + $out .= fread($pipes[1], 1024); } proc_close($p); @@ -36,7 +35,6 @@ proc_close($p); echo $out; ?> -==DONE== --EXPECTF-- array(4) { [0]=> @@ -48,4 +46,3 @@ array(4) { [3]=> string(14) "карамба" } -==DONE== diff --git a/ext/standard/tests/general_functions/proc_open.phpt b/ext/standard/tests/general_functions/proc_open.phpt index 4d0a21d165..cf0bffffb5 100644 --- a/ext/standard/tests/general_functions/proc_open.phpt +++ b/ext/standard/tests/general_functions/proc_open.phpt @@ -8,16 +8,16 @@ if (!function_exists("proc_open")) echo "skip proc_open() is not available"; --FILE-- <?php $ds = array( - 0 => array("pipe", "r"), - 1 => array("pipe", "w"), - 2 => array("pipe", "w") - ); + 0 => array("pipe", "r"), + 1 => array("pipe", "w"), + 2 => array("pipe", "w") + ); $cat = proc_open( - "/bin/cat", - $ds, - $pipes - ); + "/bin/cat", + $ds, + $pipes + ); proc_close($cat); diff --git a/ext/standard/tests/general_functions/proc_open02.phpt b/ext/standard/tests/general_functions/proc_open02.phpt index d5d878ed24..a81ce5934f 100644 --- a/ext/standard/tests/general_functions/proc_open02.phpt +++ b/ext/standard/tests/general_functions/proc_open02.phpt @@ -10,9 +10,9 @@ if (getenv('SKIP_SLOW_TESTS')) echo 'skip slow test'; $ds = array(array('pipe', 'r')); $cat = proc_open( - '/bin/sleep 2', - $ds, - $pipes + '/bin/sleep 2', + $ds, + $pipes ); usleep(20000); // let the OS run the sleep process before sending the signal diff --git a/ext/standard/tests/general_functions/proc_open_array.phpt b/ext/standard/tests/general_functions/proc_open_array.phpt index 8b42a55bac..7e822880d3 100644 --- a/ext/standard/tests/general_functions/proc_open_array.phpt +++ b/ext/standard/tests/general_functions/proc_open_array.phpt @@ -10,14 +10,26 @@ $ds = [ 2 => ['pipe', 'w'], ]; -echo "Empty command array:"; -var_dump(proc_open([], $ds, $pipes)); - -echo "\nNul byte in program name:"; -var_dump(proc_open(["php\0oops"], $ds, $pipes)); - -echo "\nNul byte in argument:"; -var_dump(proc_open(["php", "arg\0oops"], $ds, $pipes)); +echo "Empty command array:\n"; +try { + proc_open([], $ds, $pipes); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +echo "\nNul byte in program name:\n"; +try { + proc_open(["php\0oops"], $ds, $pipes); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +echo "\nNul byte in argument:\n"; +try { + proc_open(["php", "arg\0oops"], $ds, $pipes); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} echo "\nBasic usage:\n"; $proc = proc_open([$php, '-r', 'echo "Hello World!\n";'], $ds, $pipes); @@ -54,18 +66,15 @@ fpassthru($pipes[1]); proc_close($proc); ?> ---EXPECTF-- +--EXPECT-- Empty command array: -Warning: proc_open(): Command array must have at least one element in %s on line %d -bool(false) +proc_open(): Argument #1 ($cmd) must have at least one element Nul byte in program name: -Warning: proc_open(): Command array element 1 contains a null byte in %s on line %d -bool(false) +Command array element 1 contains a null byte Nul byte in argument: -Warning: proc_open(): Command array element 2 contains a null byte in %s on line %d -bool(false) +Command array element 2 contains a null byte Basic usage: Hello World! diff --git a/ext/standard/tests/general_functions/proc_open_pipes1.phpt b/ext/standard/tests/general_functions/proc_open_pipes1.phpt index dd0550f7fd..076b8c941e 100644 --- a/ext/standard/tests/general_functions/proc_open_pipes1.phpt +++ b/ext/standard/tests/general_functions/proc_open_pipes1.phpt @@ -4,7 +4,7 @@ proc_open() with > 16 pipes <?php for ($i = 3; $i<= 30; $i++) { - $spec[$i] = array('pipe', 'w'); + $spec[$i] = array('pipe', 'w'); } $php = getenv("TEST_PHP_EXECUTABLE"); diff --git a/ext/standard/tests/general_functions/proc_open_pipes3.phpt b/ext/standard/tests/general_functions/proc_open_pipes3.phpt index 7671b1dce1..307fbbaa1d 100644 --- a/ext/standard/tests/general_functions/proc_open_pipes3.phpt +++ b/ext/standard/tests/general_functions/proc_open_pipes3.phpt @@ -4,7 +4,7 @@ proc_open() with invalid pipes <?php for ($i = 3; $i<= 5; $i++) { - $spec[$i] = array('pipe', 'w'); + $spec[$i] = array('pipe', 'w'); } $php = getenv("TEST_PHP_EXECUTABLE"); @@ -14,7 +14,11 @@ $spec[$i] = array('pi'); proc_open("$php -n $callee", $spec, $pipes); $spec[$i] = 1; -proc_open("$php -n $callee", $spec, $pipes); +try { + proc_open("$php -n $callee", $spec, $pipes); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} $spec[$i] = array('pipe', "test"); proc_open("$php -n $callee", $spec, $pipes); @@ -28,8 +32,7 @@ echo "END\n"; ?> --EXPECTF-- Warning: proc_open(): pi is not a valid descriptor spec/mode in %s on line %d - -Warning: proc_open(): Descriptor item must be either an array or a File-Handle in %s on line %d +proc_open(): Argument #2 ($descriptorspec) must only contain arrays and File-Handles array(4) { [3]=> resource(%d) of type (Unknown) @@ -41,7 +44,7 @@ array(4) { resource(%d) of type (Unknown) } -Warning: proc_open(test): failed to open stream: %s in %s on line %d +Warning: proc_open(test): Failed to open stream: %s in %s on line %d array(4) { [3]=> resource(%d) of type (Unknown) diff --git a/ext/standard/tests/general_functions/proc_open_redirect.phpt b/ext/standard/tests/general_functions/proc_open_redirect.phpt index 92da696ee9..76940b715d 100644 --- a/ext/standard/tests/general_functions/proc_open_redirect.phpt +++ b/ext/standard/tests/general_functions/proc_open_redirect.phpt @@ -4,9 +4,23 @@ Redirection support in proc_open <?php $php = getenv('TEST_PHP_EXECUTABLE'); -var_dump(proc_open([$php], [['redirect']], $pipes)); -var_dump(proc_open([$php], [['redirect', 'foo']], $pipes)); -var_dump(proc_open([$php], [['redirect', 42]], $pipes)); +try { + proc_open([$php], [['redirect']], $pipes); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + proc_open([$php], [['redirect', 'foo']], $pipes); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + proc_open([$php], [['redirect', 42]], $pipes); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} echo "\nWith pipe:\n"; $cmd = [$php, '-r', 'echo "Test\n"; fprintf(STDERR, "Error");']; @@ -38,14 +52,10 @@ proc_close($proc); ?> --EXPECTF-- -Warning: proc_open(): Missing redirection target in %s on line %d -bool(false) - -Warning: proc_open(): Redirection target must be an integer in %s on line %d -bool(false) +Missing redirection target +Redirection target must be of type int, string given -Warning: proc_open(): Redirection target 42 not found in %s on line %d -bool(false) +Warning: proc_open(): Redirection target 42 not found in %s With pipe: array(1) { diff --git a/ext/standard/tests/general_functions/putenv.phpt b/ext/standard/tests/general_functions/putenv.phpt index ab2c1b41f7..163fa7e4a7 100644 --- a/ext/standard/tests/general_functions/putenv.phpt +++ b/ext/standard/tests/general_functions/putenv.phpt @@ -15,12 +15,21 @@ var_dump(getenv($var_name)); var_dump(putenv($var_name)); var_dump(getenv($var_name)); -var_dump(putenv("=123")); -var_dump(putenv("")); +try { + putenv("=123"); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + putenv(""); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- bool(false) bool(true) string(5) "value" @@ -28,10 +37,6 @@ bool(true) string(0) "" bool(true) bool(false) - -Warning: putenv(): Invalid parameter syntax in %s on line %d -bool(false) - -Warning: putenv(): Invalid parameter syntax in %s on line %d -bool(false) +putenv(): Argument #1 ($setting) must have a valid syntax +putenv(): Argument #1 ($setting) must have a valid syntax Done diff --git a/ext/standard/tests/general_functions/putenv_bug75574_cp936_win.phpt b/ext/standard/tests/general_functions/putenv_bug75574_cp936_win.phpt index 69c455d076..9a92bef794 100644 --- a/ext/standard/tests/general_functions/putenv_bug75574_cp936_win.phpt +++ b/ext/standard/tests/general_functions/putenv_bug75574_cp936_win.phpt @@ -34,7 +34,6 @@ var_dump(putenv('FOO=°¡a°¡°¡°¡'), getenv("FOO")); var_dump(putenv('FOO=°¡a°¡°¡°¡°¡'), getenv("FOO")); ?> -===DONE=== --EXPECT-- bool(true) string(2) "°¡" @@ -58,4 +57,3 @@ bool(true) string(9) "°¡a°¡°¡°¡" bool(true) string(11) "°¡a°¡°¡°¡°¡" -===DONE=== diff --git a/ext/standard/tests/general_functions/putenv_bug75574_utf8.phpt b/ext/standard/tests/general_functions/putenv_bug75574_utf8.phpt index ea8a0ab119..edf4c72f44 100644 --- a/ext/standard/tests/general_functions/putenv_bug75574_utf8.phpt +++ b/ext/standard/tests/general_functions/putenv_bug75574_utf8.phpt @@ -23,7 +23,6 @@ var_dump(putenv('FOO=å•Šaå•Šå•Šå•Š'), getenv("FOO")); var_dump(putenv('FOO=å•Šaå•Šå•Šå•Šå•Š'), getenv("FOO")); ?> -===DONE=== --EXPECT-- bool(true) string(3) "å•Š" @@ -47,4 +46,3 @@ bool(true) string(13) "å•Šaå•Šå•Šå•Š" bool(true) string(16) "å•Šaå•Šå•Šå•Šå•Š" -===DONE=== diff --git a/ext/standard/tests/general_functions/rand.phpt b/ext/standard/tests/general_functions/rand.phpt index e6639a71c7..73dec4eb75 100644 --- a/ext/standard/tests/general_functions/rand.phpt +++ b/ext/standard/tests/general_functions/rand.phpt @@ -4,60 +4,36 @@ rand() and mt_rand() tests <?php var_dump(mt_rand()); -var_dump(mt_rand(-1)); var_dump(mt_rand(-1,1)); var_dump(mt_rand(0,3)); var_dump(rand()); -var_dump(rand(-1)); var_dump(rand(-1,1)); var_dump(rand(0,3)); var_dump(srand()); var_dump(srand(-1)); -var_dump(srand(array())); var_dump(mt_srand()); var_dump(mt_srand(-1)); -var_dump(mt_srand(array())); var_dump(getrandmax()); -var_dump(getrandmax(1)); var_dump(mt_getrandmax()); -var_dump(mt_getrandmax(1)); echo "Done\n"; ?> --EXPECTF-- int(%d) - -Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) int(%d) - -Warning: rand() expects exactly 2 parameters, 1 given in %s on line %d -NULL int(%i) int(%d) NULL NULL - -Warning: srand() expects parameter 1 to be int, array given in %s on line %d -NULL -NULL NULL - -Warning: mt_srand() expects parameter 1 to be int, array given in %s on line %d NULL int(%d) - -Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL int(%d) - -Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/register_tick_function_error.phpt b/ext/standard/tests/general_functions/register_tick_function_error.phpt new file mode 100644 index 0000000000..c44dbe0872 --- /dev/null +++ b/ext/standard/tests/general_functions/register_tick_function_error.phpt @@ -0,0 +1,14 @@ +--TEST-- +register_tick_function only accepts a valid callback as parameter +--FILE-- +<?php +declare(ticks=1); + +try { + register_tick_function("a"); +} catch (TypeError $exception) { + echo $exception->getMessage() . "\n"; +} +?> +--EXPECT-- +register_tick_function(): Argument #1 ($function) must be a valid tick callback, 'a' given diff --git a/ext/standard/tests/general_functions/sleep_basic.phpt b/ext/standard/tests/general_functions/sleep_basic.phpt index 0ef0e7c213..4371cc99ed 100644 --- a/ext/standard/tests/general_functions/sleep_basic.phpt +++ b/ext/standard/tests/general_functions/sleep_basic.phpt @@ -20,7 +20,7 @@ set_time_limit(20); $time_start = microtime(true); // Sleep for a while -sleep($sleeptime); +$result = sleep($sleeptime); // Test passes if sleeps for at least 98% of specified time $sleeplow = $sleeptime - ($sleeptime * 2 /100); @@ -29,16 +29,16 @@ $time_end = microtime(true); $time = $time_end - $time_start; echo "Thread slept for " . $time . " seconds\n"; +echo "Return value: " . $result . "\n"; if ($time >= $sleeplow) { - echo "TEST PASSED\n"; + echo "TEST PASSED\n"; } else { - echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n"; + echo "TEST FAILED - time is ${time} secs and sleep was ${sleeptime} secs\n"; } ?> -===DONE=== --EXPECTF-- *** Testing sleep() : basic functionality *** Thread slept for %f seconds +Return value: 0 TEST PASSED -===DONE=== diff --git a/ext/standard/tests/general_functions/sleep_error.phpt b/ext/standard/tests/general_functions/sleep_error.phpt index c4f069a3d2..bfe66480fa 100644 --- a/ext/standard/tests/general_functions/sleep_error.phpt +++ b/ext/standard/tests/general_functions/sleep_error.phpt @@ -2,43 +2,13 @@ Test sleep() function : error conditions --FILE-- <?php -/* Prototype : int sleep ( int $seconds ) - * Description: Delays the program execution for the given number of seconds . - * Source code: ext/standard/basic_functions.c - */ - set_time_limit(20); -echo "*** Testing sleep() : error conditions ***\n"; - -echo "\n-- Testing sleep() function with zero arguments --\n"; -var_dump( sleep() ); - -echo "\n-- Testing sleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( sleep($seconds, $extra_arg) ); - -echo "\n-- Testing sleep() function with negative interval --\n"; -$seconds = -10; -var_dump( sleep($seconds) ); +sleep(-10); ?> -===DONE=== --EXPECTF-- -*** Testing sleep() : error conditions *** - --- Testing sleep() function with zero arguments -- - -Warning: sleep() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing sleep() function with more than expected no. of arguments -- - -Warning: sleep() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - --- Testing sleep() function with negative interval -- - -Warning: sleep(): Number of seconds must be greater than or equal to 0 in %s on line %d -bool(false) -===DONE=== +Fatal error: Uncaught ValueError: sleep(): Argument #1 ($seconds) must be greater than or equal to 0 in %s:%d +Stack trace: +#0 %s(%d): sleep(-10) +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/general_functions/strval.phpt b/ext/standard/tests/general_functions/strval.phpt index e904fdcaa0..a75ac12272 100644 --- a/ext/standard/tests/general_functions/strval.phpt +++ b/ext/standard/tests/general_functions/strval.phpt @@ -141,13 +141,6 @@ foreach ($not_scalars as $value ) { var_dump( strval($value) ); } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_dump( strval() ); - -//arguments more than expected -var_dump( strval( $scalars[0], $scalars[1]) ); - echo "Done\n"; // close the resources used @@ -284,19 +277,19 @@ string(14) "Resource id #%d" string(14) "Resource id #%d" -- Iteration 4 -- -Notice: Array to string conversion in %sstrval.php on line %d +Warning: Array to string conversion in %s on line %d string(5) "Array" -- Iteration 5 -- -Notice: Array to string conversion in %sstrval.php on line %d +Warning: Array to string conversion in %s on line %d string(5) "Array" -- Iteration 6 -- -Notice: Array to string conversion in %sstrval.php on line %d +Warning: Array to string conversion in %s on line %d string(5) "Array" -- Iteration 7 -- -Notice: Array to string conversion in %sstrval.php on line %d +Warning: Array to string conversion in %s on line %d string(5) "Array" -- Iteration 8 -- string(0) "" @@ -306,12 +299,4 @@ string(0) "" string(0) "" -- Iteration 11 -- string(0) "" - -*** Testing error conditions *** - -Warning: strval() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: strval() expects exactly 1 parameter, 2 given in %s on line %d -NULL Done diff --git a/ext/standard/tests/general_functions/sys_getloadavg.phpt b/ext/standard/tests/general_functions/sys_getloadavg.phpt index 5763084f70..1775978a12 100644 --- a/ext/standard/tests/general_functions/sys_getloadavg.phpt +++ b/ext/standard/tests/general_functions/sys_getloadavg.phpt @@ -7,14 +7,11 @@ if (!function_exists("sys_getloadavg")) die("skip"); --FILE-- <?php -var_dump(sys_getloadavg("")); var_dump(sys_getloadavg()); echo "Done\n"; ?> --EXPECTF-- -Warning: sys_getloadavg() expects exactly 0 parameters, %d given in %s -NULL array(3) { [0]=> float(%f) diff --git a/ext/standard/tests/general_functions/type.phpt b/ext/standard/tests/general_functions/type.phpt index 0b460b08d1..a32e4b44a1 100644 --- a/ext/standard/tests/general_functions/type.phpt +++ b/ext/standard/tests/general_functions/type.phpt @@ -4,7 +4,7 @@ gettype(), settype() and friends <?php function foo($errno, $errstr, $errfile, $errline) { - var_dump($errstr); + var_dump($errstr); } set_error_handler("foo"); @@ -17,43 +17,43 @@ $var1 = "another string"; $var2 = array(2,3,4); $array = array( - array(1,2,3), - $var1, - $var2, - 1, - 2.0, - NULL, - false, - "some string", - $fp, - $fp1, - new stdclass, + array(1,2,3), + $var1, + $var2, + 1, + 2.0, + NULL, + false, + "some string", + $fp, + $fp1, + new stdclass, ); $types = array( - "null", - "integer", - "double", - "boolean", - "resource", - "array", - "object", - "string" - ); + "null", + "integer", + "double", + "boolean", + "resource", + "array", + "object", + "string" + ); foreach ($array as $var) { - var_dump(gettype($var)); + var_dump(gettype($var)); } foreach ($types as $type) { - foreach ($array as $var) { - try { - var_dump(settype($var, $type)); - } catch (Error $e) { - echo "Error: ", $e->getMessage(), "\n"; - } - var_dump($var); - } + foreach ($array as $var) { + try { + var_dump(settype($var, $type)); + } catch (Error $e) { + echo "Error: ", $e->getMessage(), "\n"; + } + var_dump($var); + } } echo "Done\n"; @@ -160,8 +160,7 @@ bool(true) bool(true) bool(true) bool(true) -string(42) "settype(): Cannot convert to resource type" -bool(false) +Error: Cannot convert to resource type array(3) { [0]=> int(1) @@ -170,11 +169,9 @@ array(3) { [2]=> int(3) } -string(42) "settype(): Cannot convert to resource type" -bool(false) +Error: Cannot convert to resource type string(14) "another string" -string(42) "settype(): Cannot convert to resource type" -bool(false) +Error: Cannot convert to resource type array(3) { [0]=> int(2) @@ -183,29 +180,21 @@ array(3) { [2]=> int(4) } -string(42) "settype(): Cannot convert to resource type" -bool(false) +Error: Cannot convert to resource type int(1) -string(42) "settype(): Cannot convert to resource type" -bool(false) +Error: Cannot convert to resource type float(2) -string(42) "settype(): Cannot convert to resource type" -bool(false) +Error: Cannot convert to resource type NULL -string(42) "settype(): Cannot convert to resource type" -bool(false) -bool(false) -string(42) "settype(): Cannot convert to resource type" +Error: Cannot convert to resource type bool(false) +Error: Cannot convert to resource type string(11) "some string" -string(42) "settype(): Cannot convert to resource type" -bool(false) +Error: Cannot convert to resource type resource(%d) of type (Unknown) -string(42) "settype(): Cannot convert to resource type" -bool(false) +Error: Cannot convert to resource type resource(%d) of type (stream) -string(42) "settype(): Cannot convert to resource type" -bool(false) +Error: Cannot convert to resource type object(stdClass)#%d (0) { } bool(true) diff --git a/ext/standard/tests/general_functions/uniqid_basic.phpt b/ext/standard/tests/general_functions/uniqid_basic.phpt index 285365ab60..6bfc478fad 100644 --- a/ext/standard/tests/general_functions/uniqid_basic.phpt +++ b/ext/standard/tests/general_functions/uniqid_basic.phpt @@ -18,23 +18,22 @@ echo "uniqid() with a prefix\n"; // Use a fixed prefix so we can ensure length of o/p id is fixed $prefix = array ( - 99999, - "99999", - 10.5e2, - null, - true, - false - ); + 99999, + "99999", + 10.5e2, + null, + true, + false + ); for ($i = 0; $i < count($prefix); $i++) { - var_dump(uniqid($prefix[$i])); - var_dump(uniqid($prefix[$i], true)); - var_dump(uniqid($prefix[$i], false)); - echo "\n"; + var_dump(uniqid($prefix[$i])); + var_dump(uniqid($prefix[$i], true)); + var_dump(uniqid($prefix[$i], false)); + echo "\n"; } ?> -===DONE=== --EXPECTF-- *** Testing uniqid() : basic functionality *** @@ -69,4 +68,3 @@ string(13) "%s" string(23) "%s.%s" string(13) "%s" -===DONE=== diff --git a/ext/standard/tests/general_functions/usleep_basic.phpt b/ext/standard/tests/general_functions/usleep_basic.phpt index 776d634ea4..c2af61f8a2 100644 --- a/ext/standard/tests/general_functions/usleep_basic.phpt +++ b/ext/standard/tests/general_functions/usleep_basic.phpt @@ -30,13 +30,11 @@ $time = ($time_end - $time_start) * 1000 * 1000; $summary = "Thread slept for " . $time . " micro-seconds\n"; if ($time >= $sleeplow) { - echo "TEST PASSED: $summary"; + echo "TEST PASSED: $summary"; } else { - echo "TEST FAILED: $summary"; + echo "TEST FAILED: $summary"; } ?> -===DONE=== --EXPECTF-- *** Testing usleep() : basic functionality *** TEST PASSED: Thread slept for %f micro-seconds -===DONE=== diff --git a/ext/standard/tests/general_functions/usleep_error.phpt b/ext/standard/tests/general_functions/usleep_error.phpt index 474aab7d5d..46bd442058 100644 --- a/ext/standard/tests/general_functions/usleep_error.phpt +++ b/ext/standard/tests/general_functions/usleep_error.phpt @@ -2,44 +2,13 @@ Test usleep() function : error conditions --FILE-- <?php -/* Prototype : void usleep ( int $micro_seconds ) - * Description: Delays program execution for the given number of micro seconds. - * Source code: ext/standard/basic_functions.c - */ -set_time_limit(20); - -echo "*** Testing usleep() : error conditions ***\n"; - -echo "\n-- Testing usleep() function with zero arguments --\n"; -var_dump( usleep() ); - -echo "\n-- Testing usleep() function with more than expected no. of arguments --\n"; -$seconds = 10; -$extra_arg = 10; -var_dump( usleep($seconds, $extra_arg) ); - -echo "\n-- Testing usleep() function with negative interval --\n"; -$seconds = -10; -var_dump( usleep($seconds) ); +usleep(-10); ?> -===DONE=== --EXPECTF-- -*** Testing usleep() : error conditions *** - --- Testing usleep() function with zero arguments -- - -Warning: usleep() expects exactly 1 parameter, 0 given in %s on line %d -NULL - --- Testing usleep() function with more than expected no. of arguments -- - -Warning: usleep() expects exactly 1 parameter, 2 given in %s on line %d -NULL - --- Testing usleep() function with negative interval -- - -Warning: usleep(): Number of microseconds must be greater than or equal to 0 in %s on line %d -bool(false) -===DONE=== +Fatal error: Uncaught ValueError: usleep(): Argument #1 ($microseconds) must be greater than or equal to 0 in %s:%d +Stack trace: +#0 %s(%d): usleep(-10) +#1 {main} + thrown in %s on line %d diff --git a/ext/standard/tests/general_functions/var_dump.phpt b/ext/standard/tests/general_functions/var_dump.phpt index 4641051541..476620ff26 100644 --- a/ext/standard/tests/general_functions/var_dump.phpt +++ b/ext/standard/tests/general_functions/var_dump.phpt @@ -99,7 +99,7 @@ $strings = array ( 'PHP', "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL - "1234\t\n5678\n\t9100\rabcda" // strings with escape characters + "1234\t\n5678\n\t9100\"abcda" // strings with escape characters ); /* calling check_vardump() to display contents of strings using var_dump() */ @@ -239,8 +239,8 @@ $resources = array ( using var_dump() */ check_vardump($resources); -echo "\n*** Testing var_dump() on different combinations of scalar - and non-scalar variables ***\n"; +echo "\n*** Testing var_dump() on different combinations of scalar + and non-scalar variables ***\n"; /* a variable which is unset */ $unset_var = 10.5; unset($unset_var); @@ -260,32 +260,20 @@ $variations = array ( non-scalar variables using var_dump() */ check_vardump($variations); -echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n"; +echo "\n*** Testing var_dump() on miscellaneous input arguments ***\n"; $misc_values = array ( @$unset_var, NULL, // NULL argument @$undef_variable, //undefined variable null ); -/* calling check_vardump() to display miscelleneous data using var_dump() */ +/* calling check_vardump() to display miscellaneous data using var_dump() */ check_vardump($misc_values); echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -/* checking var_dump() on functions */ -echo "\n*** Testing var_dump() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -var_dump( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); @@ -462,7 +450,7 @@ string(34) "abcd -- Iteration 14 -- string(22) "1234 5678 - 9100
abcda" + 9100"abcda" *** Testing var_dump() on boolean variables *** -- Iteration 1 -- @@ -848,8 +836,8 @@ resource(%d) of type (stream) -- Iteration 2 -- resource(%d) of type (stream) -*** Testing var_dump() on different combinations of scalar - and non-scalar variables *** +*** Testing var_dump() on different combinations of scalar + and non-scalar variables *** -- Iteration 1 -- array(3) { [0]=> @@ -935,7 +923,7 @@ array(4) { string(5) "/00\7" } -*** Testing var_dump() on miscelleneous input arguments *** +*** Testing var_dump() on miscellaneous input arguments *** -- Iteration 1 -- NULL -- Iteration 2 -- @@ -1116,7 +1104,7 @@ array(14) { [13]=> string(22) "1234 5678 - 9100
abcda" + 9100"abcda" } array(15) { [0]=> @@ -1561,17 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing var_dump() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -string(9) "2 * 3 = 6" - -Deprecated: Function create_function() is deprecated in %s on line %d -string(9) " - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_dump_64bit.phpt b/ext/standard/tests/general_functions/var_dump_64bit.phpt index 738de410e4..7b74761586 100644 --- a/ext/standard/tests/general_functions/var_dump_64bit.phpt +++ b/ext/standard/tests/general_functions/var_dump_64bit.phpt @@ -99,7 +99,7 @@ $strings = array ( 'PHP', "abcd\x0n1234\x0005678\x0000efgh\xijkl", // strings with hexadecimal NULL "abcd\0efgh\0ijkl\x00mnop\x000qrst\00uvwx\0000yz", // strings with octal NULL - "1234\t\n5678\n\t9100\rabcda" // strings with escape characters + "1234\t\n5678\n\t9100\"abcda" // strings with escape characters ); /* calling check_vardump() to display contents of strings using var_dump() */ @@ -239,8 +239,8 @@ $resources = array ( using var_dump() */ check_vardump($resources); -echo "\n*** Testing var_dump() on different combinations of scalar - and non-scalar variables ***\n"; +echo "\n*** Testing var_dump() on different combinations of scalar + and non-scalar variables ***\n"; /* a variable which is unset */ $unset_var = 10.5; unset($unset_var); @@ -260,38 +260,26 @@ $variations = array ( non-scalar variables using var_dump() */ check_vardump($variations); -echo "\n*** Testing var_dump() on miscelleneous input arguments ***\n"; +echo "\n*** Testing var_dump() on miscellaneous input arguments ***\n"; $misc_values = array ( @$unset_var, NULL, // NULL argument @$undef_variable, //undefined variable null ); -/* calling check_vardump() to display miscelleneous data using var_dump() */ +/* calling check_vardump() to display miscellaneous data using var_dump() */ check_vardump($misc_values); echo "\n*** Testing var_dump() on multiple arguments ***\n"; var_dump( $integers, $floats, $strings, $arrays, $booleans, $resources, $objects, $misc_values, $variations ); -/* checking var_dump() on functions */ -echo "\n*** Testing var_dump() on anonymous functions ***\n"; -$newfunc = create_function('$a,$b', 'return "$a * $b = " . ($a * $b);'); -echo "New anonymous function: $newfunc\n"; -var_dump( $newfunc(2, 3) ); -/* creating anonymous function dynamically */ -var_dump( create_function('$a', 'return "$a * $a = " . ($a * $b);') ); - -echo "\n*** Testing error conditions ***\n"; -//passing zero argument -var_dump(); - /* closing resource handle used */ closedir($dir_handle); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing var_dump() on integer variables *** -- Iteration 1 -- int(0) @@ -462,7 +450,7 @@ string(34) "abcd -- Iteration 14 -- string(22) "1234 5678 - 9100
abcda" + 9100"abcda" *** Testing var_dump() on boolean variables *** -- Iteration 1 -- @@ -848,8 +836,8 @@ resource(5) of type (stream) -- Iteration 2 -- resource(6) of type (stream) -*** Testing var_dump() on different combinations of scalar - and non-scalar variables *** +*** Testing var_dump() on different combinations of scalar + and non-scalar variables *** -- Iteration 1 -- array(3) { [0]=> @@ -935,7 +923,7 @@ array(4) { string(5) "/00\7" } -*** Testing var_dump() on miscelleneous input arguments *** +*** Testing var_dump() on miscellaneous input arguments *** -- Iteration 1 -- NULL -- Iteration 2 -- @@ -1116,7 +1104,7 @@ array(14) { [13]=> string(22) "1234 5678 - 9100
abcda" + 9100"abcda" } array(15) { [0]=> @@ -1561,17 +1549,4 @@ array(6) { string(5) "/00\7" } } - -*** Testing var_dump() on anonymous functions *** - -Deprecated: Function create_function() is deprecated in %s on line %d -New anonymous function: -string(9) "2 * 3 = 6" - -Deprecated: Function create_function() is deprecated in %s on line %d -string(9) " - -*** Testing error conditions *** - -Warning: var_dump() expects at least 1 parameter, 0 given in %s on line %d Done diff --git a/ext/standard/tests/general_functions/var_export-locale.phpt b/ext/standard/tests/general_functions/var_export-locale.phpt index 61d94f83f4..9f9cd0e896 100644 --- a/ext/standard/tests/general_functions/var_export-locale.phpt +++ b/ext/standard/tests/general_functions/var_export-locale.phpt @@ -58,12 +58,12 @@ $counter++; echo "*** Testing var_export() with valid boolean values ***\n"; // different valid boolean values $valid_bool = array( - 1, - TRUE, + 1, + TRUE, true, 0, - FALSE, - false + FALSE, + false ); $counter = 1; /* Loop to check for above boolean values with var_export() */ @@ -303,18 +303,11 @@ echo "\n"; $counter++; } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_export( var_export() ); - -//arguments more than expected -var_export( var_export(TRUE, FALSE, TRUE) ); - -echo "\n\nDone"; +echo "\nDone"; ?> ---EXPECTF-- +--EXPECT-- *** Testing var_export() with integer values *** *** Output for integer values *** @@ -1138,11 +1131,4 @@ NULL string(4) "NULL" -*** Testing error conditions *** - -Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d -NULL -Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/general_functions/var_export-locale_32.phpt b/ext/standard/tests/general_functions/var_export-locale_32.phpt index af9efd9e24..d64fa3b8d7 100644 --- a/ext/standard/tests/general_functions/var_export-locale_32.phpt +++ b/ext/standard/tests/general_functions/var_export-locale_32.phpt @@ -20,7 +20,7 @@ setlocale(LC_ALL, "german", "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","d */ echo "*** Testing var_export() with integer values ***\n"; -// different integer vlaues +// different integer values $valid_ints = array( '0', '1', @@ -56,14 +56,14 @@ $counter++; } echo "*** Testing var_export() with valid boolean values ***\n"; -// different valid boolean vlaues +// different valid boolean values $valid_bool = array( - 1, - TRUE, + 1, + TRUE, true, 0, - FALSE, - false + FALSE, + false ); $counter = 1; /* Loop to check for above boolean values with var_export() */ @@ -80,7 +80,7 @@ $counter++; } echo "*** Testing var_export() with valid float values ***\n"; -// different valid float vlaues +// different valid float values $valid_floats = array( (float)-2147483649, // float value (float)2147483648, // float value @@ -279,7 +279,7 @@ $counter++; } echo "*** Testing var_export() with valid null values ***\n"; -// different valid null vlaues +// different valid null values $unset_var = array(); unset ($unset_var); // now a null $null_var = NULL; @@ -303,14 +303,7 @@ echo "\n"; $counter++; } -echo "\n*** Testing error conditions ***\n"; -//Zero argument -var_export( var_export() ); - -//arguments more than expected -var_export( var_export(TRUE, FALSE, TRUE) ); - -echo "\n\nDone"; +echo "\nDone"; ?> @@ -1138,11 +1131,4 @@ NULL string(4) "NULL" -*** Testing error conditions *** - -Warning: var_export() expects at least 1 parameter, 0 given in %s on line %d -NULL -Warning: var_export() expects at most 2 parameters, 3 given in %s on line %d -NULL - Done diff --git a/ext/standard/tests/general_functions/var_export_basic1.phpt b/ext/standard/tests/general_functions/var_export_basic1.phpt index 18fa404c29..27c56a7b8f 100644 --- a/ext/standard/tests/general_functions/var_export_basic1.phpt +++ b/ext/standard/tests/general_functions/var_export_basic1.phpt @@ -40,16 +40,15 @@ $valid_ints = array( /* Loop to check for above integer values with var_export() */ echo "\n*** Output for integer values ***\n"; foreach($valid_ints as $key => $int_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $int_value ); - echo "\n"; - var_export( $int_value, FALSE); - echo "\n"; - var_dump( var_export( $int_value, TRUE) ); + echo "\n-- Iteration: $key --\n"; + var_export( $int_value ); + echo "\n"; + var_export( $int_value, FALSE); + echo "\n"; + var_dump( var_export( $int_value, TRUE) ); } ?> -===DONE=== --EXPECT-- *** Testing var_export() with integer values *** @@ -144,4 +143,3 @@ string(11) "-2147483648" 2147483647 2147483647 string(10) "2147483647" -===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_basic1_32.phpt b/ext/standard/tests/general_functions/var_export_basic1_32.phpt index 95596800d6..0eb6ce889f 100644 --- a/ext/standard/tests/general_functions/var_export_basic1_32.phpt +++ b/ext/standard/tests/general_functions/var_export_basic1_32.phpt @@ -15,7 +15,7 @@ if (PHP_INT_SIZE > 4) { */ echo "*** Testing var_export() with integer values ***\n"; -// different integer vlaues +// different integer values $valid_ints = array( '0' => '0', '1' => '1', @@ -40,16 +40,15 @@ $valid_ints = array( /* Loop to check for above integer values with var_export() */ echo "\n*** Output for integer values ***\n"; foreach($valid_ints as $key => $int_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $int_value ); - echo "\n"; - var_export( $int_value, FALSE); - echo "\n"; - var_dump( var_export( $int_value, TRUE) ); + echo "\n-- Iteration: $key --\n"; + var_export( $int_value ); + echo "\n"; + var_export( $int_value, FALSE); + echo "\n"; + var_dump( var_export( $int_value, TRUE) ); } ?> -===DONE=== --EXPECT-- *** Testing var_export() with integer values *** @@ -144,4 +143,3 @@ string(13) "-2147483647-1" 2147483647 2147483647 string(10) "2147483647" -===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_basic2.phpt b/ext/standard/tests/general_functions/var_export_basic2.phpt index 29c3a138f9..1698a28001 100644 --- a/ext/standard/tests/general_functions/var_export_basic2.phpt +++ b/ext/standard/tests/general_functions/var_export_basic2.phpt @@ -12,27 +12,26 @@ Test var_export() function with valid boolean values echo "*** Testing var_export() with valid boolean values ***\n"; // different valid boolean values $valid_bool = array( - "1" => 1, - "TRUE" => TRUE, + "1" => 1, + "TRUE" => TRUE, "true" => true, "0" => 0, - "FALSE" => FALSE, - "false" => false + "FALSE" => FALSE, + "false" => false ); /* Loop to check for above boolean values with var_export() */ echo "\n*** Output for boolean values ***\n"; foreach($valid_bool as $key => $bool_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $bool_value ); - echo "\n"; - var_export( $bool_value, FALSE); - echo "\n"; - var_dump( var_export( $bool_value, TRUE) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $bool_value ); + echo "\n"; + var_export( $bool_value, FALSE); + echo "\n"; + var_dump( var_export( $bool_value, TRUE) ); + echo "\n"; } ?> -===DONE=== --EXPECT-- *** Testing var_export() with valid boolean values *** @@ -73,4 +72,3 @@ false false string(5) "false" -===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_basic3.phpt b/ext/standard/tests/general_functions/var_export_basic3.phpt index b66d2c4584..92d5bbbe76 100644 --- a/ext/standard/tests/general_functions/var_export_basic3.phpt +++ b/ext/standard/tests/general_functions/var_export_basic3.phpt @@ -13,41 +13,40 @@ serialize_precision=17 echo "*** Testing var_export() with valid float values ***\n"; // different valid float values $valid_floats = array( - "-2147483649" => (float)-2147483649, // float value - "2147483648" => (float)2147483648, // float value - "-0x80000001" => (float)-0x80000001, // float value, beyond max negative int - "0x800000001" => (float)0x800000001, // float value, beyond max positive int - "020000000001" => (float)020000000001, // float value, beyond max positive int - "-020000000001" => (float)-020000000001, // float value, beyond max negative int - "0.0" => 0.0, - "-0.1" => -0.1, - "10.0000000000000000005" => 10.0000000000000000005, - "10.5e+5" => 10.5e+5, - "1e5" => 1e5, - "1e-5" => 1e-5, - "1e+5" => 1e+5, - "1E5" => 1E5, - "1E+5" => 1E+5, - "1E-5" => 1E-5, - ".5e+7" => .5e+7, - ".6e-19" => .6e-19, - ".05E+44" => .05E+44, - ".0034E-30" => .0034E-30 + "-2147483649" => (float)-2147483649, // float value + "2147483648" => (float)2147483648, // float value + "-0x80000001" => (float)-0x80000001, // float value, beyond max negative int + "0x800000001" => (float)0x800000001, // float value, beyond max positive int + "020000000001" => (float)020000000001, // float value, beyond max positive int + "-020000000001" => (float)-020000000001, // float value, beyond max negative int + "0.0" => 0.0, + "-0.1" => -0.1, + "10.0000000000000000005" => 10.0000000000000000005, + "10.5e+5" => 10.5e+5, + "1e5" => 1e5, + "1e-5" => 1e-5, + "1e+5" => 1e+5, + "1E5" => 1E5, + "1E+5" => 1E+5, + "1E-5" => 1E-5, + ".5e+7" => .5e+7, + ".6e-19" => .6e-19, + ".05E+44" => .05E+44, + ".0034E-30" => .0034E-30 ); /* Loop to check for above float values with var_export() */ echo "\n*** Output for float values ***\n"; foreach($valid_floats as $key => $float_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $float_value ); - echo "\n"; - var_export( $float_value, FALSE); - echo "\n"; - var_dump( var_export( $float_value, TRUE) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $float_value ); + echo "\n"; + var_export( $float_value, FALSE); + echo "\n"; + var_dump( var_export( $float_value, TRUE) ); + echo "\n"; } ?> -===DONE=== --EXPECT-- *** Testing var_export() with valid float values *** @@ -172,4 +171,3 @@ string(22) "5.0000000000000001E+42" 3.4000000000000001E-33 string(22) "3.4000000000000001E-33" -===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_basic4.phpt b/ext/standard/tests/general_functions/var_export_basic4.phpt index b99f4584a6..789140d255 100644 --- a/ext/standard/tests/general_functions/var_export_basic4.phpt +++ b/ext/standard/tests/general_functions/var_export_basic4.phpt @@ -33,17 +33,16 @@ $valid_strings = array( /* Loop to check for above strings with var_export() */ echo "\n*** Output for strings ***\n"; foreach($valid_strings as $key => $str) { - echo "\n-- Iteration: $key --\n"; - var_export( $str ); - echo "\n"; - var_export( $str, FALSE); - echo "\n"; - var_dump( var_export( $str, TRUE) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $str ); + echo "\n"; + var_export( $str, FALSE); + echo "\n"; + var_dump( var_export( $str, TRUE) ); + echo "\n"; } ?> -===DONE=== --EXPECT-- *** Testing var_export() with valid strings *** @@ -144,4 +143,3 @@ string(7) "'\\060'" '8' string(3) "'8'" -===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_basic5.phpt b/ext/standard/tests/general_functions/var_export_basic5.phpt index ab81fa802e..731e84ff99 100644 --- a/ext/standard/tests/general_functions/var_export_basic5.phpt +++ b/ext/standard/tests/general_functions/var_export_basic5.phpt @@ -34,16 +34,15 @@ $valid_arrays = array( /* Loop to check for above arrays with var_export() */ echo "\n*** Output for arrays ***\n"; foreach($valid_arrays as $key => $arr) { - echo "\n--Iteration: $key --\n"; - var_export( $arr ); - echo "\n"; - var_export( $arr, FALSE); - echo "\n"; - var_dump( var_export( $arr, TRUE) ); - echo "\n"; + echo "\n--Iteration: $key --\n"; + var_export( $arr ); + echo "\n"; + var_export( $arr, FALSE); + echo "\n"; + var_dump( var_export( $arr, TRUE) ); + echo "\n"; } ?> -===DONE=== --EXPECT-- *** Testing var_export() with valid arrays *** @@ -276,4 +275,3 @@ string(41) "array ( 1 => 'test', )" -===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_basic6.phpt b/ext/standard/tests/general_functions/var_export_basic6.phpt index 6eff478d70..4d09f0a794 100644 --- a/ext/standard/tests/general_functions/var_export_basic6.phpt +++ b/ext/standard/tests/general_functions/var_export_basic6.phpt @@ -92,16 +92,15 @@ $valid_objects = array( /* Loop to check for above objects with var_export() */ echo "\n*** Output for objects ***\n"; foreach($valid_objects as $key => $obj) { - echo "\n-- Iteration: $key --\n"; - var_export( $obj ); - echo "\n"; - var_export( $obj, FALSE); - echo "\n"; - var_dump( var_export( $obj, TRUE) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $obj ); + echo "\n"; + var_export( $obj, FALSE); + echo "\n"; + var_dump( var_export( $obj, TRUE) ); + echo "\n"; } ?> -===DONE=== --EXPECT-- *** Testing var_export() with valid objects *** @@ -307,4 +306,3 @@ concreteClass::__set_state(array( string(36) "concreteClass::__set_state(array( ))" -===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_basic7.phpt b/ext/standard/tests/general_functions/var_export_basic7.phpt index 817ffc91f0..f9a68f0f13 100644 --- a/ext/standard/tests/general_functions/var_export_basic7.phpt +++ b/ext/standard/tests/general_functions/var_export_basic7.phpt @@ -24,16 +24,15 @@ $valid_nulls = array( /* Loop to check for above null values with var_export() */ echo "\n*** Output for null values ***\n"; foreach($valid_nulls as $key => $null_value) { - echo "\n-- Iteration: $key --\n"; - var_export( $null_value ); - echo "\n"; - var_export( $null_value, FALSE); - echo "\n"; - var_dump( var_export( $null_value, true) ); - echo "\n"; + echo "\n-- Iteration: $key --\n"; + var_export( $null_value ); + echo "\n"; + var_export( $null_value, FALSE); + echo "\n"; + var_dump( var_export( $null_value, true) ); + echo "\n"; } ?> -===DONE=== --EXPECT-- *** Testing var_export() with valid null values *** @@ -56,4 +55,3 @@ NULL NULL string(4) "NULL" -===DONE=== diff --git a/ext/standard/tests/general_functions/var_export_basic9.phpt b/ext/standard/tests/general_functions/var_export_basic9.phpt index fd78c18c8e..26815bec1b 100644 --- a/ext/standard/tests/general_functions/var_export_basic9.phpt +++ b/ext/standard/tests/general_functions/var_export_basic9.phpt @@ -2,9 +2,9 @@ Bug #55082: var_export() doesn't escape properties properly --FILE-- <?php - $x = new stdClass(); - $x->{'\'\\'} = 7; - echo var_export($x); + $x = new stdClass(); + $x->{'\'\\'} = 7; + echo var_export($x); --EXPECT-- (object) array( '\'\\' => 7, diff --git a/ext/standard/tests/general_functions/var_export_error2.phpt b/ext/standard/tests/general_functions/var_export_error2.phpt index eedb757d20..83dd2aa297 100644 --- a/ext/standard/tests/general_functions/var_export_error2.phpt +++ b/ext/standard/tests/general_functions/var_export_error2.phpt @@ -8,11 +8,10 @@ Test var_export() function : error conditions - recursive object * Alias to functions: */ -@$obj->p =& $obj; +$obj = new stdClass; +$obj->p =& $obj; var_export($obj, true); ?> -===DONE=== --EXPECTF-- -Warning: var_export does not handle circular references in %s on line 9 -===DONE=== +Warning: var_export does not handle circular references in %s on line 10 diff --git a/ext/standard/tests/general_functions/var_export_error3.phpt b/ext/standard/tests/general_functions/var_export_error3.phpt index 38b5dbc28c..7c2bc54ef3 100644 --- a/ext/standard/tests/general_functions/var_export_error3.phpt +++ b/ext/standard/tests/general_functions/var_export_error3.phpt @@ -12,7 +12,5 @@ $a[] =& $a; var_export($a, true); ?> -===DONE=== --EXPECTF-- Warning: var_export does not handle circular references in %s on line 9 -===DONE=== |