diff options
Diffstat (limited to 'Zend')
111 files changed, 343 insertions, 2307 deletions
diff --git a/Zend/tests/007.phpt b/Zend/tests/007.phpt deleted file mode 100644 index 6120181269..0000000000 --- a/Zend/tests/007.phpt +++ /dev/null @@ -1,65 +0,0 @@ ---TEST-- -each() tests ---FILE-- -<?php - -var_dump(each()); -$var = 1; -var_dump(each($var)); -$var = "string"; -var_dump(each($var)); -$var = array(1,2,3); -var_dump(each($var)); -$var = array("a"=>1,"b"=>2,"c"=>3); -var_dump(each($var)); - -$a = array(1); -$a [] =&$a[0]; - -var_dump(each($a)); - - -echo "Done\n"; -?> ---EXPECTF-- -Warning: each() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL - -Warning: Variable passed to each() is not an array or object in %s on line %d -NULL -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - int(0) - ["key"]=> - int(0) -} -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - string(1) "a" - ["key"]=> - string(1) "a" -} -array(4) { - [1]=> - int(1) - ["value"]=> - int(1) - [0]=> - int(0) - ["key"]=> - int(0) -} -Done diff --git a/Zend/tests/008.phpt b/Zend/tests/008.phpt index 0766c3e1a4..cacba06370 100644 --- a/Zend/tests/008.phpt +++ b/Zend/tests/008.phpt @@ -29,7 +29,9 @@ NULL Warning: define() expects at least 2 parameters, 1 given in %s on line %d NULL -bool(true) + +Notice: Constant TRUE already defined in %s on line %d +bool(false) Warning: define() expects parameter 3 to be bool, array given in %s on line %d NULL diff --git a/Zend/tests/009.phpt b/Zend/tests/009.phpt index 82cfabee49..4a34fe4c84 100644 --- a/Zend/tests/009.phpt +++ b/Zend/tests/009.phpt @@ -16,9 +16,6 @@ class foo { class foo2 extends foo { } -foo::bar(); -foo2::bar(); - $f1 = new foo; $f2 = new foo2; @@ -36,11 +33,6 @@ $f1->testNull(); echo "Done\n"; ?> --EXPECTF-- -Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d -string(3) "foo" - -Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d -string(3) "foo" string(3) "foo" string(3) "foo" diff --git a/Zend/tests/anonymous_func_001.phpt b/Zend/tests/anonymous_func_001.phpt deleted file mode 100644 index 97b91b6544..0000000000 --- a/Zend/tests/anonymous_func_001.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -Testing calls to anonymous function ---FILE-- -<?php - -for ($i = 0; $i < 10; $i++) { - $a = create_function('', 'return '. $i .';'); - var_dump($a()); - - $b = "\0lambda_". ($i + 1); - var_dump($b()); -} - -?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -int(0) -int(0) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(1) -int(1) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(2) -int(2) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(3) -int(3) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(4) -int(4) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(5) -int(5) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(6) -int(6) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(7) -int(7) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(8) -int(8) - -Deprecated: Function create_function() is deprecated in %s on line %d -int(9) -int(9) diff --git a/Zend/tests/anonymous_func_002.phpt b/Zend/tests/anonymous_func_002.phpt deleted file mode 100644 index 28adc357da..0000000000 --- a/Zend/tests/anonymous_func_002.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Testing anonymous function return as array key and accessing $GLOBALS ---FILE-- -<?php - -$test = create_function('$v', 'return $v;'); - -$arr = array(create_function('', 'return $GLOBALS["arr"];'), 2); - -var_dump($arr[$test(1)]); -var_dump($arr[$test(0)]() == $arr); - -?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d - -Deprecated: Function create_function() is deprecated in %s on line %d -int(2) -bool(true) diff --git a/Zend/tests/anonymous_func_003.phpt b/Zend/tests/anonymous_func_003.phpt deleted file mode 100644 index d2610310f7..0000000000 --- a/Zend/tests/anonymous_func_003.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Using throw $var with anonymous function return ---FILE-- -<?php - -try { - $a = create_function('', 'return new Exception("test");'); - throw $a(); -} catch (Exception $e) { - var_dump($e->getMessage() == 'test'); -} - -?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -bool(true) diff --git a/Zend/tests/assert/bug70208.phpt b/Zend/tests/assert/bug70208.phpt deleted file mode 100644 index 6b7dfaeb33..0000000000 --- a/Zend/tests/assert/bug70208.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Bug #70208 (scope information must be preserved with assert()) ---FILE-- -<?php - -function non_class_scope() { - return true; -} - -class test { - protected $prop = 1; - - public function __construct() { - assert('non_class_scope();'); - var_dump($this->prop); - } -} - -new test; - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d -int(1) diff --git a/Zend/tests/assert/indirect_var_access_misoptimization.phpt b/Zend/tests/assert/indirect_var_access_misoptimization.phpt deleted file mode 100644 index 02327f30c0..0000000000 --- a/Zend/tests/assert/indirect_var_access_misoptimization.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Misoptimization when variable is modified by assert() ---INI-- -zend.assertions=1 ---FILE-- -<?php - -function test() { - $i = 0; - assert('$i = new stdClass'); - $i += 1; - var_dump($i); -} -test(); - -?> ---EXPECTF-- -Deprecated: assert(): Calling assert() with a string argument is deprecated in %s on line %d - -Notice: Object of class stdClass could not be converted to number in %s on line %d -int(2) diff --git a/Zend/tests/bug26697.phpt b/Zend/tests/bug26697.phpt index fe269c0364..c0a4850e55 100644 --- a/Zend/tests/bug26697.phpt +++ b/Zend/tests/bug26697.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #26697 (calling class_exists on a nonexistent class in __autoload results in segfault) +Bug #26697 (calling class_exists on a nonexistent class in autoloader results in segfault) --FILE-- <?php diff --git a/Zend/tests/bug27669.phpt b/Zend/tests/bug27669.phpt index 97b15590e2..747593031f 100644 --- a/Zend/tests/bug27669.phpt +++ b/Zend/tests/bug27669.phpt @@ -3,7 +3,7 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy --FILE-- <?php class A { - function hello() { + static function hello() { echo "Hello World\n"; } } @@ -12,6 +12,5 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy ?> ===DONE=== --EXPECTF-- -Deprecated: Non-static method A::hello() should not be called statically in %s on line %d Hello World ===DONE=== diff --git a/Zend/tests/bug31102.phpt b/Zend/tests/bug31102.phpt index fd6da0f7c2..624eee52ba 100644 --- a/Zend/tests/bug31102.phpt +++ b/Zend/tests/bug31102.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #31102 (Exception not handled when thrown inside __autoload()) +Bug #31102 (Exception not handled when thrown inside autoloader) --FILE-- <?php diff --git a/Zend/tests/bug33116.phpt b/Zend/tests/bug33116.phpt index 13aae6611e..b336171165 100644 --- a/Zend/tests/bug33116.phpt +++ b/Zend/tests/bug33116.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #33116 (crash when assigning class name to global variable in __autoload) +Bug #33116 (crash when assigning class name to global variable in autoloader) --FILE-- <?php spl_autoload_register(function ($class) { diff --git a/Zend/tests/bug35437.phpt b/Zend/tests/bug35437.phpt deleted file mode 100644 index 4f61e4fbfd..0000000000 --- a/Zend/tests/bug35437.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Bug #35437 (Segfault or Invalid Opcode 137/1/4) ---FILE-- -<?php -function err2exception($errno, $errstr) -{ - throw new Exception("Error occuried: " . $errstr); -} - -set_error_handler('err2exception'); - -class TestClass -{ - function testMethod() - { - $GLOBALS['t'] = new stdClass; - } -} - -try { - TestClass::testMethod(); -} catch (Exception $e) { - echo "Caught: ".$e->getMessage()."\n"; -} -?> ---EXPECT-- -Caught: Error occuried: Non-static method TestClass::testMethod() should not be called statically diff --git a/Zend/tests/bug37138.phpt b/Zend/tests/bug37138.phpt index 4a084d4bb1..c0aa1fdfa8 100644 --- a/Zend/tests/bug37138.phpt +++ b/Zend/tests/bug37138.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #37138 (__autoload tries to load callback'ed self and parent) +Bug #37138 (autoloader tries to load callback'ed self and parent) --FILE-- <?php spl_autoload_register(function ($CN) { var_dump ($CN); }); diff --git a/Zend/tests/bug37811.phpt b/Zend/tests/bug37811.phpt index 96645d0354..8321459d5d 100644 --- a/Zend/tests/bug37811.phpt +++ b/Zend/tests/bug37811.phpt @@ -23,6 +23,7 @@ string(3) "Foo" Warning: Constants may only evaluate to scalar values, arrays or resources in %sbug37811.php on line %d -Warning: Use of undefined constant Baz - assumed 'Baz' (this will throw an Error in a future version of PHP) in %sbug37811.php on line %d -string(3) "Baz" -===DONE=== +Fatal error: Uncaught Error: Undefined constant 'Baz' in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/bug38047.phpt b/Zend/tests/bug38047.phpt deleted file mode 100644 index e6eeb6631d..0000000000 --- a/Zend/tests/bug38047.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Bug #38047 ("file" and "line" sometimes not set in backtrace from inside error handler) ---FILE-- -<?php -error_reporting(E_ALL); -set_error_handler('kalus_error_handler'); -ini_set("display_errors", "on"); - -class A { - function A_ftk($a) { - } -} - -function kalus_error_handler($error_code, $error_string, $filename, $line, $symbols) { - echo "$error_string\n"; - get_error_context(); -} - -function get_error_context() { - $backtrace = debug_backtrace(); - $n = 1; - foreach ($backtrace as $call) { - echo $n++." "; - if (isset($call["file"])) { - echo $call["file"]; - if (isset($call["line"])) { - echo ":".$call["line"]; - } - } - if (isset($call["function"])) { - echo " ".$call["function"]."()"; - } - echo "\n"; - } - echo "\n"; -} - -//This will not create file and line items for the call into the error handler -$page["name"] = A::A_ftk(); -?> ---EXPECTF-- -Non-static method A::A_ftk() should not be called statically -1 %sbug38047.php:13 get_error_context() -2 %sbug38047.php:36 kalus_error_handler() - - -Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::A_ftk(), 0 passed in %sbug38047.php on line 36 and exactly 1 expected in %sbug38047.php:7 -Stack trace: -#0 %sbug38047.php(36): A::A_ftk() -#1 {main} - thrown in %sbug38047.php on line 7 diff --git a/Zend/tests/bug38942.phpt b/Zend/tests/bug38942.phpt deleted file mode 100644 index d0335b1071..0000000000 --- a/Zend/tests/bug38942.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug #38942 (Double old-style-ctor inheritance) ---FILE-- -<?php -class foo { - public function foo() {} -} - -class bar extends foo { -} -print_r(get_class_methods("bar")); -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d -Array -( - [0] => foo -) diff --git a/Zend/tests/bug39003.phpt b/Zend/tests/bug39003.phpt index dc1c69e8c7..791e11b614 100644 --- a/Zend/tests/bug39003.phpt +++ b/Zend/tests/bug39003.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #39003 (__autoload() is called for type hinting) +Bug #39003 (autoloader is called for type hinting) --FILE-- <?php diff --git a/Zend/tests/bug39127.phpt b/Zend/tests/bug39127.phpt deleted file mode 100644 index 31fb6d27d5..0000000000 --- a/Zend/tests/bug39127.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug #39127 (Old-style constructor fallbacks produce strange results) ---FILE-- -<?php - -class a { function a() { var_dump("a::a() called"); } } -class b extends a {} - -$b = new b; -var_dump(is_callable(array($b,"a"))); -var_dump(is_callable(array($b,"b"))); -var_dump(is_callable(array($b,"__construct"))); - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in %s on line %d -string(13) "a::a() called" -bool(true) -bool(false) -bool(false) -Done diff --git a/Zend/tests/bug40236.phpt b/Zend/tests/bug40236.phpt index f9a4277249..5a86ba47d9 100644 --- a/Zend/tests/bug40236.phpt +++ b/Zend/tests/bug40236.phpt @@ -2,7 +2,6 @@ Bug #40236 (php -a function allocation eats memory) --SKIPIF-- <?php -if (php_sapi_name() != "cli") die("skip CLI only"); if (extension_loaded("readline")) die("skip Test doesn't support readline"); ?> --FILE-- diff --git a/Zend/tests/bug40621.phpt b/Zend/tests/bug40621.phpt index b56a28e58b..8650fd56fa 100644 --- a/Zend/tests/bug40621.phpt +++ b/Zend/tests/bug40621.phpt @@ -15,10 +15,7 @@ Foo::get(); echo "Done\n"; ?> --EXPECTF-- -Deprecated: Non-static method Foo::get() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Non-static method Foo::__construct() cannot be called statically in %s:%d +Fatal error: Uncaught Error: Non-static method Foo::get() cannot be called statically in %s:%d Stack trace: -#0 %s(%d): Foo::get() -#1 {main} +#0 {main} thrown in %s on line %d diff --git a/Zend/tests/bug40784.phpt b/Zend/tests/bug40784.phpt deleted file mode 100644 index ac2b2331b2..0000000000 --- a/Zend/tests/bug40784.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #40784 (Case sensivity in constructor's fallback) ---FILE-- -<?php - -class A { - function A () { echo "I'm A\n"; } -} - -class B extends A { - function __construct() { - parent::__construct(); - parent::__constrUct(); - } -} - -$b = new B; - -echo "Done\n"; -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d -I'm A -I'm A -Done diff --git a/Zend/tests/bug43323.phpt b/Zend/tests/bug43323.phpt deleted file mode 100644 index 74abe766e5..0000000000 --- a/Zend/tests/bug43323.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Bug #43323 (Wrong count abstract methods) ---FILE-- -<?php -abstract class bar { - abstract public function bar(); -} - -class foo extends bar { -} ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bar has a deprecated constructor in %s on line %d - -Fatal error: Class foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (bar::bar) in %sbug43323.php on line 7 diff --git a/Zend/tests/bug43344_1.phpt b/Zend/tests/bug43344_1.phpt index 4635240699..28af70dc67 100644 --- a/Zend/tests/bug43344_1.phpt +++ b/Zend/tests/bug43344_1.phpt @@ -3,6 +3,8 @@ Bug #43344.1 (Wrong error message for undefined namespace constant) --FILE-- <?php namespace Foo; +use Error; + function f1($a=bar) { return $a; } @@ -13,20 +15,31 @@ function f3($a=array(bar=>0)) { reset($a); return key($a); } -echo bar."\n"; -echo f1()."\n"; -echo f2()."\n"; -echo f3()."\n"; -?> ---EXPECTF-- -Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 13 -bar -Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 3 -bar - -Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 6 -bar +try { + echo bar."\n"; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +try { + echo f1()."\n"; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +try { + echo f2()."\n"; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +try { + echo f3()."\n"; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} -Warning: Use of undefined constant bar - assumed 'bar' (this will throw an Error in a future version of PHP) in %sbug43344_1.php on line 9 -bar +?> +--EXPECT-- +Undefined constant 'Foo\bar' +Undefined constant 'Foo\bar' +Undefined constant 'Foo\bar' +Undefined constant 'Foo\bar' diff --git a/Zend/tests/bug46304.phpt b/Zend/tests/bug46304.phpt index 9898838907..f8b9a0b525 100644 --- a/Zend/tests/bug46304.phpt +++ b/Zend/tests/bug46304.phpt @@ -6,9 +6,6 @@ Bug #46304 (defining namespaced constant using define()) define('NS1\ns2\const1','value1'); define('ns1\ns2\const2','value2'); define('ns1\NS2\coNSt3','value3'); -define('NS1\ns2\const4','value4', true); -define('ns1\ns2\const5','value5', true); -define('ns1\NS2\coNSt6','value6', true); print NS1\ns2\const1 . "\n"; print ns1\ns2\const1 . "\n"; @@ -22,29 +19,9 @@ print NS1\ns2\coNSt3 . "\n"; print ns1\ns2\coNSt3 . "\n"; print ns1\ns2\coNSt3 . "\n"; -print NS1\ns2\const4 . "\n"; -print ns1\ns2\const4 . "\n"; -print ns1\NS2\const4 . "\n"; -print ns1\ns2\coNSt4 . "\n"; - -print NS1\ns2\const5 . "\n"; -print ns1\ns2\const5 . "\n"; -print ns1\NS2\const5 . "\n"; -print ns1\ns2\coNSt5 . "\n"; - -print NS1\ns2\const6 . "\n"; -print ns1\ns2\const6 . "\n"; -print ns1\NS2\const6 . "\n"; -print ns1\ns2\coNSt6 . "\n"; - print NS1\ns2\coNSt1 . "\n"; ?> --EXPECTF-- -Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 6 - -Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 7 - -Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 8 value1 value1 value1 @@ -54,28 +31,6 @@ value2 value3 value3 value3 -value4 -value4 -value4 - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS1\ns2\const4" in %s on line 25 -value4 -value5 -value5 -value5 - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\ns2\const5" in %s on line 30 -value5 - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 32 -value6 - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 33 -value6 - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "ns1\NS2\coNSt6" in %s on line 34 -value6 -value6 Fatal error: Uncaught Error: Undefined constant 'NS1\ns2\coNSt1' in %sbug46304.php:%d Stack trace: diff --git a/Zend/tests/bug47054.phpt b/Zend/tests/bug47054.phpt index 9e89c2c208..f607365bdc 100644 --- a/Zend/tests/bug47054.phpt +++ b/Zend/tests/bug47054.phpt @@ -24,8 +24,6 @@ $c->s(); get_called_class(); -D::m(); - ?> --EXPECTF-- Called class: D @@ -33,11 +31,3 @@ Called class: C Called class: C Warning: get_called_class() called from outside a class in %s on line %d - -Deprecated: Non-static method D::m() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Using $this when not in object context in %s:%d -Stack trace: -#0 %s(%d): D::m() -#1 {main} - thrown in %s on line %d diff --git a/Zend/tests/bug47320.phpt b/Zend/tests/bug47320.phpt deleted file mode 100644 index 47db35edac..0000000000 --- a/Zend/tests/bug47320.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Bug #47320 ($php_errormsg out of scope in functions) ---INI-- -display_errors=0 -track_errors=1 ---FILE-- -<?php -if (!@substr('no 2nd parameter')) { - echo '$php_errormsg in global: ' . $php_errormsg . "\n"; -} - -function foo() { - if (!@strpos('no 2nd parameter')) { - echo '$php_errormsg in function: ' . $php_errormsg . "\n"; - - echo '$GLOBALS[php_errormsg] in function: ' . - $GLOBALS['php_errormsg'] . "\n"; - } -} - -foo(); -?> ---EXPECT-- -$php_errormsg in global: substr() expects at least 2 parameters, 1 given -$php_errormsg in function: strpos() expects at least 2 parameters, 1 given -$GLOBALS[php_errormsg] in function: substr() expects at least 2 parameters, 1 given diff --git a/Zend/tests/bug47572.phpt b/Zend/tests/bug47572.phpt index 67bb3ec111..7a44cc6e7f 100644 --- a/Zend/tests/bug47572.phpt +++ b/Zend/tests/bug47572.phpt @@ -14,4 +14,7 @@ $foo = new Foo(); ?> --EXPECTF-- -Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error in a future version of PHP) in %s on line %d +Fatal error: Uncaught Error: Undefined constant 'FOO' in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/bug48533.phpt b/Zend/tests/bug48533.phpt index 4fa49a2f22..3dfbc658ec 100644 --- a/Zend/tests/bug48533.phpt +++ b/Zend/tests/bug48533.phpt @@ -26,8 +26,8 @@ $x->a(); $x->b(); $x->c(); $x::a(); -$x::b(); $x::c(); +$x::b(); ?> --EXPECTF-- @@ -35,7 +35,9 @@ string(9) "__call::a" int(2) string(9) "__call::c" string(15) "__callStatic::a" - -Deprecated: Non-static method foo::b() should not be called statically in %s on line %d -int(2) string(15) "__callStatic::c" + +Fatal error: Uncaught Error: Non-static method foo::b() cannot be called statically in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/bug48693.phpt b/Zend/tests/bug48693.phpt deleted file mode 100644 index f916b6407b..0000000000 --- a/Zend/tests/bug48693.phpt +++ /dev/null @@ -1,52 +0,0 @@ ---TEST-- -Bug #48693 (Double declaration of __lambda_func when lambda wrongly formatted) ---FILE-- -<?php - -try { - $x = create_function('', 'return 1; }'); -} catch (ParseError $e) { - echo "$e\n\n"; -} -try { - $y = create_function('', 'function a() { }; return 2;'); -} catch (ParseError $e) { - echo "$e\n\n"; -} -try { - $z = create_function('', '{'); -} catch (ParseError $e) { - echo "$e\n\n"; -} -try { - $w = create_function('', 'return 3;'); -} catch (ParseError $e) { - echo "$e\n\n"; -} - -var_dump( - $y(), - $w() -); - -?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -ParseError: syntax error, unexpected '}', expecting end of file in %sbug48693.php(4) : runtime-created function:1 -Stack trace: -#0 %sbug48693.php(4): create_function('', 'return 1; }') -#1 {main} - - -Deprecated: Function create_function() is deprecated in %s on line %d - -Deprecated: Function create_function() is deprecated in %s on line %d -ParseError: syntax error, unexpected end of file in %sbug48693.php(14) : runtime-created function:1 -Stack trace: -#0 %sbug48693.php(14): create_function('', '{') -#1 {main} - - -Deprecated: Function create_function() is deprecated in %s on line %d -int(2) -int(3) diff --git a/Zend/tests/bug49908.phpt b/Zend/tests/bug49908.phpt index 2f33080258..eda913b80e 100644 --- a/Zend/tests/bug49908.phpt +++ b/Zend/tests/bug49908.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #49908 (throwing exception in __autoload crashes when interface is not defined) +Bug #49908 (throwing exception in autoloader crashes when interface is not defined) --FILE-- <?php diff --git a/Zend/tests/bug50261.phpt b/Zend/tests/bug50261.phpt deleted file mode 100644 index 321e9cfb8b..0000000000 --- a/Zend/tests/bug50261.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -Bug #50261 (Crash When Calling Parent Constructor with call_user_func()) ---FILE-- -<?php - -class testClass { - function testClass($x) { - echo __METHOD__, " (". $x . ")\n"; - } -} - -class testClass2 extends testClass { - function __construct() { - static $x = 0; - - if ($x) { - print "Infinite loop...\n"; - } else { - $x++; - - parent::__construct(1); - testclass::__construct(2); - call_user_func(array('parent', '__construct'), 3); - call_user_func(array('testclass', '__construct'), 4); - call_user_func(array('testclass', 'testclass'), 5); - } - } -} - -new testClass2; - -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; testClass has a deprecated constructor in %s on line %d -testClass::testClass (1) -testClass::testClass (2) -testClass::testClass (3) -testClass::testClass (4) -testClass::testClass (5) diff --git a/Zend/tests/bug52051.phpt b/Zend/tests/bug52051.phpt deleted file mode 100644 index acfddbc36d..0000000000 --- a/Zend/tests/bug52051.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Bug #52051 (handling of case sensitivity of old-style constructors changed in 5.3+) ---FILE-- -<?php - -class AA { - function AA() { echo "foo\n"; } -} -class bb extends AA {} -class CC extends bb { - function CC() { parent::bb(); } -} -new CC(); - -class A { - function A() { echo "bar\n"; } -} -class B extends A {} -class C extends B { - function C() { parent::B(); } -} -new C(); - -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; AA has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; CC has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d -foo -bar diff --git a/Zend/tests/bug52160.phpt b/Zend/tests/bug52160.phpt deleted file mode 100644 index a0e5a9d7ae..0000000000 --- a/Zend/tests/bug52160.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Bug #52160 (Invalid E_STRICT redefined constructor error) ---FILE-- -<?php - -class bar { - function __construct() { } - static function bar() { - var_dump(1); - } -} - -bar::bar(); - -class foo { - static function foo() { - var_dump(2); - } - function __construct() { } -} - -foo::foo(); - -class baz { - static function baz() { - var_dump(3); - } -} - -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; baz has a deprecated constructor in %s on line %d - -Fatal error: Constructor baz::baz() cannot be static in %s on line %d diff --git a/Zend/tests/bug54585.phpt b/Zend/tests/bug54585.phpt deleted file mode 100644 index deabe55af8..0000000000 --- a/Zend/tests/bug54585.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Bug #54585 (track_errors causes segfault) ---INI-- -track_errors=On ---FILE-- -<?php -function testing($source) { - unset($source[$cos]); -} -testing($_GET); -echo "ok\n"; -?> ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: cos in %sbug54585.php on line 3 -ok diff --git a/Zend/tests/bug60978.phpt b/Zend/tests/bug60978.phpt index 676808c7a3..5dc6fe31e7 100644 --- a/Zend/tests/bug60978.phpt +++ b/Zend/tests/bug60978.phpt @@ -1,11 +1,5 @@ --TEST-- Bug #60978 (exit code incorrect) ---SKIPIF-- -<?php - if ("cli" != php_sapi_name()) { - echo "skip CLI only"; - } -?> --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE'); diff --git a/Zend/tests/bug61011.phpt b/Zend/tests/bug61011.phpt index dc0aca64f8..b9088c68f1 100644 --- a/Zend/tests/bug61011.phpt +++ b/Zend/tests/bug61011.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #61011 (Crash when an exception is thrown by __autoload accessing a static property) +Bug #61011 (Crash when an exception is thrown by autoloader accessing a static property) --FILE-- <?php spl_autoload_register(function ($name) { diff --git a/Zend/tests/bug66218.phpt b/Zend/tests/bug66218.phpt index d800605ac8..db3c7c655a 100644 --- a/Zend/tests/bug66218.phpt +++ b/Zend/tests/bug66218.phpt @@ -2,7 +2,6 @@ Bug #66218 zend_register_functions breaks reflection --SKIPIF-- <?php -if (PHP_SAPI != "cli") die("skip CLI only test"); if (!function_exists("dl")) die("skip need dl"); ?> --FILE-- diff --git a/Zend/tests/bug67858.phpt b/Zend/tests/bug67858.phpt deleted file mode 100644 index 1186cd6a6f..0000000000 --- a/Zend/tests/bug67858.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #67858: Leak when $php_errormsg already set ---INI-- -track_errors=1 -error_reporting=E_ALL ---FILE-- -<?php - -function f() { - $php_errormsg = [1, 2, 3]; - echo $var; - var_dump($php_errormsg); -} -f(); - -?> ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: var in %s on line %d -string(23) "Undefined variable: var" diff --git a/Zend/tests/bug69755.phpt b/Zend/tests/bug69755.phpt index 08432808e2..e419756d26 100644 --- a/Zend/tests/bug69755.phpt +++ b/Zend/tests/bug69755.phpt @@ -5,4 +5,7 @@ Bug #69755: segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER c . 10; ?> --EXPECTF-- -Warning: Use of undefined constant c - assumed 'c' (this will throw an Error in a future version of PHP) in %sbug69755.php on line 2 +Fatal error: Uncaught Error: Undefined constant 'c' in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/bug69788.phpt b/Zend/tests/bug69788.phpt index 326328ccfa..6e877f78fa 100644 --- a/Zend/tests/bug69788.phpt +++ b/Zend/tests/bug69788.phpt @@ -5,4 +5,7 @@ Bug #69788: Malformed script causes Uncaught Error in php-cgi, valgrind SIGILL --EXPECTF-- Notice: Array to string conversion in %s on line %d -Warning: Use of undefined constant t - assumed 't' (this will throw an Error in a future version of PHP) in %s on line %d +Fatal error: Uncaught Error: Undefined constant 't' in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/bug70681.phpt b/Zend/tests/bug70681.phpt index 9dd09b07b8..d0cc9523a9 100644 --- a/Zend/tests/bug70681.phpt +++ b/Zend/tests/bug70681.phpt @@ -12,5 +12,5 @@ var_dump($c("foo")); ?> --EXPECTF-- -Warning: Cannot unbind $this of internal method in %s on line %d +Warning: Cannot unbind $this of method in %s on line %d int(3) diff --git a/Zend/tests/bug72944.phpt b/Zend/tests/bug72944.phpt index 5f494beb40..75a4edb565 100644 --- a/Zend/tests/bug72944.phpt +++ b/Zend/tests/bug72944.phpt @@ -2,11 +2,10 @@ Bug #72944 (Null pointer deref in zval_delref_p). --FILE-- <?php +define('e', 'e'); "a"== e & $A = $A? 0 : 0 ?:0; echo "OK\n"; ?> --EXPECTF-- -Warning: Use of undefined constant e - assumed 'e' (this will throw an Error in a future version of PHP) in %sbug72944.php on line 2 - -Notice: Undefined variable: A in %sbug72944.php on line 2 +Notice: Undefined variable: A in %sbug72944.php on line 3 OK diff --git a/Zend/tests/bug73163.phpt b/Zend/tests/bug73163.phpt deleted file mode 100644 index 5c0560458d..0000000000 --- a/Zend/tests/bug73163.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug #73163 (PHP hangs if error handler throws while accessing undef const in default value) ---FILE-- -<?php - -function doSomething(string $value = UNDEFINED) { -} - -set_error_handler(function($errno, $errstr) { - throw new Exception($errstr); -}); - -doSomething(); - -?> ---EXPECTF-- -Fatal error: Uncaught Exception: Use of undefined constant UNDEFINED - assumed 'UNDEFINED' (this will throw an Error in a future version of PHP) in %s:%d -Stack trace: -#0 %s(%d): {closure}(%s) -#1 %s(%d): doSomething() -#2 {main} - thrown in %s on line %d diff --git a/Zend/tests/bug73181.phpt b/Zend/tests/bug73181.phpt deleted file mode 100644 index 3ab93ebf5b..0000000000 --- a/Zend/tests/bug73181.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Bug #73181: parse_str() without a second argument leads to crash ---FILE-- -<?php - -function x() { - parse_str("1&x"); - var_dump(get_defined_vars()); -} - -x(); - -?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -array(2) { - [1]=> - string(0) "" - ["x"]=> - string(0) "" -} diff --git a/Zend/tests/bug74408.phpt b/Zend/tests/bug74408.phpt deleted file mode 100644 index e770a51dc8..0000000000 --- a/Zend/tests/bug74408.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Bug #74408 (Endless loop bypassing execution time limit) ---FILE-- -<?php - - class ErrorHandling { - - public function error_handler($errno, $errstr, $errfile, $errline) { - $bla = new NonExistingClass2(); - } - - public function exception_handler(Error $e) { - echo "Caught, exception: " . $e->getMessage(); - } - } - - set_error_handler('ErrorHandling::error_handler'); - set_exception_handler('ErrorHandling::exception_handler'); - - $blubb = new NonExistingClass(); -?> ---EXPECTF-- -Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in %sbug74408.php on line %d - -Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in %sbug74408.php on line %d - -Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in Unknown on line 0 - -Fatal error: Uncaught Error: Class 'NonExistingClass2' not found in %sbug74408.php:%d -Stack trace: -#0 [internal function]: ErrorHandling::error_handler(8192, 'Non-static meth...', '%s', %d, Array) -#1 %sbug74408.php(%d): set_exception_handler('ErrorHandling::...') -#2 {main} - thrown in %sbug74408.php on line %d diff --git a/Zend/tests/call_static_006.phpt b/Zend/tests/call_static_006.phpt index 2887afa355..946be2a3c9 100644 --- a/Zend/tests/call_static_006.phpt +++ b/Zend/tests/call_static_006.phpt @@ -4,29 +4,15 @@ Testing __callStatic <?php class foo { - public function aa() { - print "ok\n"; - } static function __callstatic($a, $b) { var_dump($a); } } -foo::aa(); - -$b = 'AA'; -foo::$b(); - foo::__construct(); ?> --EXPECTF-- -Deprecated: Non-static method foo::aa() should not be called statically in %s on line %d -ok - -Deprecated: Non-static method foo::aa() should not be called statically in %s on line %d -ok - Fatal error: Uncaught Error: Cannot call constructor in %s:%d Stack trace: #0 {main} diff --git a/Zend/tests/call_user_func_004.phpt b/Zend/tests/call_user_func_004.phpt deleted file mode 100644 index 7a2c4b8ffd..0000000000 --- a/Zend/tests/call_user_func_004.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Calling non-static method with call_user_func() ---FILE-- -<?php - -class foo { - public function teste() { - $this->a = 1; - } -} - -call_user_func(array('foo', 'teste')); - -?> ---EXPECTF-- -Deprecated: %son-static method foo::teste() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Using $this when not in object context in %s:%d -Stack trace: -#0 %s(%d): foo::teste() -#1 {main} - thrown in %s on line %d diff --git a/Zend/tests/call_user_func_005.phpt b/Zend/tests/call_user_func_005.phpt index 9305e5849c..13d69fd60d 100644 --- a/Zend/tests/call_user_func_005.phpt +++ b/Zend/tests/call_user_func_005.phpt @@ -9,7 +9,7 @@ class foo { return 1; } - public function teste() { + public static function teste() { return foo::x(function &($a=1,$b) { }); } } @@ -18,7 +18,6 @@ var_dump(call_user_func(array('foo', 'teste'))); ?> --EXPECTF-- -Deprecated: %son-static method foo::teste() should not be called statically in %s on line %d string(1) "x" array(1) { [0]=> diff --git a/Zend/tests/case_insensitive_constant_deprecation.phpt b/Zend/tests/case_insensitive_constant_deprecation.phpt deleted file mode 100644 index e7a92c8c4c..0000000000 --- a/Zend/tests/case_insensitive_constant_deprecation.phpt +++ /dev/null @@ -1,127 +0,0 @@ ---TEST-- -Case-insensitive constants are deprecated ---FILE-- -<?php - -namespace { - define('FOO', 42, true); // Deprecated - define('NS\FOO', 24, true); // Deprecated - - var_dump(FOO); // Ok - var_dump(foo); // Deprecated - - var_dump(NS\FOO); // Ok - var_dump(ns\FOO); // Ok - var_dump(ns\foo); // Deprecated - - var_dump(defined('FOO')); // Ok - var_dump(defined('foo')); // Ok - var_dump(defined('NS\FOO')); // Ok - var_dump(defined('ns\FOO')); // Ok - var_dump(defined('ns\foo')); // Ok - - var_dump(constant('FOO')); // Ok - var_dump(constant('foo')); // Deprecated - var_dump(constant('NS\FOO')); // Ok - var_dump(constant('ns\FOO')); // Ok - var_dump(constant('ns\foo')); // Deprecated -} - -namespace NS { - var_dump(FOO); // Ok - var_dump(foo); // Deprecated -} - -namespace ns { - var_dump(FOO); // Ok - var_dump(foo); // Deprecated -} - -namespace Other { - var_dump(FOO); // Ok - var_dump(foo); // Deprecated - - var_dump(defined('FOO')); // Ok - var_dump(defined('foo')); // Ok - var_dump(defined('NS\FOO')); // Ok - var_dump(defined('ns\FOO')); // Ok - var_dump(defined('ns\foo')); // Ok - - var_dump(constant('FOO')); // Ok - var_dump(constant('foo')); // Deprecated - var_dump(constant('NS\FOO')); // Ok - var_dump(constant('ns\FOO')); // Ok - var_dump(constant('ns\foo')); // Deprecated - - const C1 = FOO; // Ok - var_dump(C1); - const C2 = foo; // Deprecated - var_dump(C2); - const C3 = 1 + FOO; // Ok - var_dump(C3); - const C4 = 1 + foo; // Deprecated - var_dump(C4); -} - -?> ---EXPECTF-- -Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 4 - -Deprecated: define(): Declaration of case-insensitive constants is deprecated in %s on line 5 -int(42) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 8 -int(42) -int(24) -int(24) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 12 -int(24) -bool(true) -bool(true) -bool(true) -bool(true) -bool(true) -int(42) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 21 -int(42) -int(24) -int(24) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 24 -int(24) -int(24) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 29 -int(24) -int(24) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 34 -int(24) -int(42) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 39 -int(42) -bool(true) -bool(true) -bool(true) -bool(true) -bool(true) -int(42) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 48 -int(42) -int(24) -int(24) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "NS\FOO" in %s on line 51 -int(24) -int(42) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 55 -int(42) -int(43) - -Deprecated: Case-insensitive constants are deprecated. The correct casing for this constant is "FOO" in %s on line 59 -int(43) diff --git a/Zend/tests/catch.phpt b/Zend/tests/catch.phpt index a83dd75baf..2e61fef935 100644 --- a/Zend/tests/catch.phpt +++ b/Zend/tests/catch.phpt @@ -1,5 +1,5 @@ --TEST-- -catch shouldn't call __autoload +catch shouldn't call autoloader --FILE-- <?php diff --git a/Zend/tests/closure_025.phpt b/Zend/tests/closure_025.phpt deleted file mode 100644 index b3d03a7ad9..0000000000 --- a/Zend/tests/closure_025.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Closure 025: Using closure in create_function() ---FILE-- -<?php - -$a = create_function('$x', 'return function($y) use ($x) { return $x * $y; };'); - -var_dump($a(2)->__invoke(4)); - -?> ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d -int(8) diff --git a/Zend/tests/closure_061.phpt b/Zend/tests/closure_061.phpt index f01e393570..2c574c49c0 100644 --- a/Zend/tests/closure_061.phpt +++ b/Zend/tests/closure_061.phpt @@ -175,9 +175,7 @@ Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure ------------------- bindTo(null, Cls::class): -Unbinding $this of a method is deprecated - -Success! +Cannot unbind $this of method bindTo(new Cls, Cls::class): Success! @@ -210,10 +208,10 @@ bindTo(new ClsUnrelated, SplDoublyLinkedList::class): Cannot bind method SplDoublyLinkedList::count() to object of class ClsUnrelated bindTo(null, null): -Cannot unbind $this of internal method +Cannot unbind $this of method bindTo(null, SplDoublyLinkedList::class): -Cannot unbind $this of internal method +Cannot unbind $this of method bindTo(new SplDoublyLinkedList, null): Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() diff --git a/Zend/tests/closures/closure_from_callable_non_static_statically.phpt b/Zend/tests/closures/closure_from_callable_non_static_statically.phpt index 17d39c052e..24df1d186a 100644 --- a/Zend/tests/closures/closure_from_callable_non_static_statically.phpt +++ b/Zend/tests/closures/closure_from_callable_non_static_statically.phpt @@ -17,4 +17,4 @@ try { ?> --EXPECT-- -Failed to create closure from callable: non-static method A::method() should not be called statically +Failed to create closure from callable: non-static method A::method() cannot be called statically diff --git a/Zend/tests/constant_expressions_classes.phpt b/Zend/tests/constant_expressions_classes.phpt index eed006bfe1..89cabc0f91 100644 --- a/Zend/tests/constant_expressions_classes.phpt +++ b/Zend/tests/constant_expressions_classes.phpt @@ -4,8 +4,6 @@ Constant scalar expressions with autoloading and classes opcache.enable=1 opcache.enable_cli=1 opcache.optimization_level=-1 ---SKIPIF-- -<?php if (php_sapi_name() != "cli") die("skip CLI only"); ?> --FILE-- <?php diff --git a/Zend/tests/constants_002.phpt b/Zend/tests/constants_002.phpt index b0cf1db61f..ddb2e67307 100644 --- a/Zend/tests/constants_002.phpt +++ b/Zend/tests/constants_002.phpt @@ -4,7 +4,11 @@ Defining constants with non-scalar values <?php define('foo', new stdClass); -var_dump(foo); +try { + var_dump(foo); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} define('foo', fopen(__FILE__, 'r')); var_dump(foo); @@ -12,7 +16,5 @@ var_dump(foo); ?> --EXPECTF-- Warning: Constants may only evaluate to scalar values, arrays or resources in %s on line %d - -Warning: Use of undefined constant foo - assumed 'foo' (this will throw an Error in a future version of PHP) in %s on line %d -string(%d) "foo" -resource(%d) of type (stream) +Undefined constant 'foo' +resource(5) of type (stream) diff --git a/Zend/tests/constants_005.phpt b/Zend/tests/constants_005.phpt index b5a3a6bd38..27ab0259d1 100644 --- a/Zend/tests/constants_005.phpt +++ b/Zend/tests/constants_005.phpt @@ -2,11 +2,10 @@ Persistent case insensitive and user defined constants --FILE-- <?php -var_dump(ZEND_THREAD_safe); +var_dump(defined('ZEND_THREAD_safe')); define("ZEND_THREAD_safe", 123); var_dump(ZEND_THREAD_safe); ?> ---EXPECTF-- -Warning: Use of undefined constant ZEND_THREAD_safe - assumed 'ZEND_THREAD_safe' (this will throw an Error in a future version of PHP) in %s on line %d -string(16) "ZEND_THREAD_safe" +--EXPECT-- +bool(false) int(123) diff --git a/Zend/tests/custom_assert_deprecation.phpt b/Zend/tests/custom_assert_forbidden.phpt index b4e22843dd..492a656f39 100644 --- a/Zend/tests/custom_assert_deprecation.phpt +++ b/Zend/tests/custom_assert_forbidden.phpt @@ -9,4 +9,4 @@ function assert() {} ?> --EXPECTF-- -Deprecated: Defining a custom assert() function is deprecated, as the function has special semantics in %s on line %d +Fatal error: Defining a custom assert() function is not allowed, as the function has special semantics in %s on line %d diff --git a/Zend/tests/dynamic_call_001.phpt b/Zend/tests/dynamic_call_001.phpt deleted file mode 100644 index 7f8a6c0b3d..0000000000 --- a/Zend/tests/dynamic_call_001.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Testing dynamic call to constructor (old-style) ---FILE-- -<?php - -class foo { - public function foo() { - } -} - -$a = 'foo'; - -$a::$a(); - -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d - -Fatal error: Uncaught Error: Non-static method foo::foo() cannot be called statically in %s:%d -Stack trace: -#0 {main} - thrown in %s on line %d diff --git a/Zend/tests/dynamic_call_006.phpt b/Zend/tests/dynamic_call_006.phpt index 058e22fda0..7a2872bcca 100644 --- a/Zend/tests/dynamic_call_006.phpt +++ b/Zend/tests/dynamic_call_006.phpt @@ -9,15 +9,9 @@ function test() { $func = 'compact'; $func(['a']); - $func = 'parse_str'; - $func('a=b'); - $func = 'get_defined_vars'; $func(); - $func = 'assert'; - $func('1==2'); - $func = 'func_get_args'; $func(); @@ -35,12 +29,8 @@ Warning: Cannot call extract() dynamically in %s on line %d Warning: Cannot call compact() dynamically in %s on line %d -Warning: Cannot call parse_str() with a single argument dynamically in %s on line %d - Warning: Cannot call get_defined_vars() dynamically in %s on line %d -Warning: Cannot call assert() with string argument dynamically in %s on line %d - Warning: Cannot call func_get_args() dynamically in %s on line %d Warning: Cannot call func_get_arg() dynamically in %s on line %d diff --git a/Zend/tests/each_001.phpt b/Zend/tests/each_001.phpt deleted file mode 100644 index f2cae3d875..0000000000 --- a/Zend/tests/each_001.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -Testing each() with an undefined variable ---FILE-- -<?php - -each($foo); - -?> ---EXPECTF-- -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d - -Warning: Variable passed to each() is not an array or object in %s on line %d diff --git a/Zend/tests/each_002.phpt b/Zend/tests/each_002.phpt deleted file mode 100644 index 5454f5ce0f..0000000000 --- a/Zend/tests/each_002.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Testing each() with array and object ---FILE-- -<?php - -$a = new stdClass; -$foo = each($a); -var_dump($foo); - -$a = new stdClass; -var_dump(each($a)); - -$a = array(new stdClass); -var_dump(each($a)); - - -?> ---EXPECTF-- -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -bool(false) -bool(false) -array(4) { - [1]=> - object(stdClass)#1 (0) { - } - ["value"]=> - object(stdClass)#1 (0) { - } - [0]=> - int(0) - ["key"]=> - int(0) -} diff --git a/Zend/tests/each_003.phpt b/Zend/tests/each_003.phpt deleted file mode 100644 index d0038c0561..0000000000 --- a/Zend/tests/each_003.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Testing each() with recursion ---INI-- -zend.enable_gc=1 ---FILE-- -<?php - -$a = array(array()); -$a[] =& $a; - -var_dump(each($a[1])); - -?> ---EXPECTF-- -Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d -array(4) { - [1]=> - array(0) { - } - ["value"]=> - array(0) { - } - [0]=> - int(0) - ["key"]=> - int(0) -} diff --git a/Zend/tests/errmsg_012.phpt b/Zend/tests/errmsg_012.phpt deleted file mode 100644 index c914125af5..0000000000 --- a/Zend/tests/errmsg_012.phpt +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -errmsg: __autoload() must take exactly 1 argument ---FILE-- -<?php - -function __autoload($a, $b) {} - -echo "Done\n"; -?> ---EXPECTF-- -Fatal error: __autoload() must take exactly 1 argument in %s on line %d diff --git a/Zend/tests/exception_012.phpt b/Zend/tests/exception_012.phpt deleted file mode 100644 index 4a1070330a..0000000000 --- a/Zend/tests/exception_012.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -Test exception doesn't cause RSHUTDOWN bypass, variation 1 ---INI-- -assert.bail=1 -assert.exception=1 ---FILE-- -<?php - -$func = create_function('', 'define("Mommy", 1); assert(false);'); -$func(); - -?> ---EXPECTHEADERS-- -Content-type: text/html; charset=UTF-8 ---EXPECTF-- -Deprecated: Function create_function() is deprecated in %s on line %d - -Fatal error: Uncaught AssertionError: assert(false) in %sexception_012.php(%d) : runtime-created function:%d -Stack trace: -#0 %sexception_012.php(%d) : runtime-created function(%d): assert(false, 'assert(false)') -#1 %sexception_012.php(%d): __lambda_func() -#2 {main} - thrown in %sexception_012.php(%d) : runtime-created function on line %d diff --git a/Zend/tests/exception_017.phpt b/Zend/tests/exception_017.phpt index f980b297fb..77fbf2d844 100644 --- a/Zend/tests/exception_017.phpt +++ b/Zend/tests/exception_017.phpt @@ -12,28 +12,29 @@ function foo(callable $x) { try { C::foo(); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo $e, "\n\n"; } try { foo("C::foo"); } catch (Error $e) { - echo "\n"; - do { - echo "Exception: " . $e->getMessage() . "\n"; - $e = $e->getPrevious(); - } while ($e instanceof Error); + echo $e, "\n\n"; } C::foo(); ?> --EXPECTF-- -Exception: Cannot call abstract method C::foo() in %sexception_017.php on line %d +Error: Cannot call abstract method C::foo() in %s:%d +Stack trace: +#0 {main} + +TypeError: Argument 1 passed to foo() must be callable, string given, called in %s on line %d and defined in %s:%d +Stack trace: +#0 %s(%d): foo('C::foo') +#1 {main} -Exception: Argument 1 passed to foo() must be callable, string given, called in %sexception_017.php on line %d -Exception: Cannot call abstract method C::foo() -Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %sexception_017.php:%d +Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %s:%d Stack trace: #0 {main} - thrown in %sexception_017.php on line %d + thrown in %s on line %d diff --git a/Zend/tests/fr47160.phpt b/Zend/tests/fr47160.phpt index 786183c0c1..6567804902 100644 --- a/Zend/tests/fr47160.phpt +++ b/Zend/tests/fr47160.phpt @@ -36,20 +36,6 @@ class Magic3 { } } -$f = array('Hello','world'); -try { - var_dump($f('you')); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} -try { - var_dump(call_user_func($f, 'you')); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} - -printf("-----\n"); - $h= new Hello; $f = array($h,'world'); var_dump($f('again')); @@ -107,14 +93,6 @@ var_dump(call_user_func($f, 'you')); ?> --EXPECTF-- -Deprecated: Non-static method Hello::world() should not be called statically in %s on line %d -Hello, you -Exception: Using $this when not in object context - -Deprecated: %son-static method Hello::world() should not be called statically in %s on line %d -Hello, you -Exception: Using $this when not in object context ------ Hello, again object(Hello)#%d (0) { } diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt index 25c95ba219..8c7461e4f7 100644 --- a/Zend/tests/incompat_ctx_user.phpt +++ b/Zend/tests/incompat_ctx_user.phpt @@ -4,18 +4,17 @@ Incompatible context call (non-internal function) <?php class A { - function foo() { var_dump(get_class($this)); } + function foo() { var_dump(get_class($this)); } } class B { - function bar() { A::foo(); } + function bar() { A::foo(); } } $b = new B; try { - $b->bar(); + $b->bar(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } ?> --EXPECTF-- -Deprecated: Non-static method A::foo() should not be called statically in %s on line %d -Exception: Using $this when not in object context +Exception: Non-static method A::foo() cannot be called statically diff --git a/Zend/tests/indirect_call_array_005.phpt b/Zend/tests/indirect_call_array_005.phpt index 4938856ed2..bd11df2d12 100644 --- a/Zend/tests/indirect_call_array_005.phpt +++ b/Zend/tests/indirect_call_array_005.phpt @@ -19,10 +19,7 @@ $callback = ['TestClass', 'method']; echo $callback(); ?> --EXPECTF-- -Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Using $this when not in object context in %s:%d +Fatal error: Uncaught Error: Non-static method TestClass::method() cannot be called statically in %s:%d Stack trace: -#0 %s(%d): TestClass::method() -#1 {main} +#0 {main} thrown in %s on line %d diff --git a/Zend/tests/indirect_call_string_003.phpt b/Zend/tests/indirect_call_string_003.phpt index a6839df8a7..99289c4e1c 100644 --- a/Zend/tests/indirect_call_string_003.phpt +++ b/Zend/tests/indirect_call_string_003.phpt @@ -19,10 +19,7 @@ $callback = 'TestClass::method'; echo $callback(); ?> --EXPECTF-- -Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Using $this when not in object context in %s:%d +Fatal error: Uncaught Error: Non-static method TestClass::method() cannot be called statically in %s:%d Stack trace: -#0 %s(%d): TestClass::method() -#1 {main} +#0 {main} thrown in %s on line %d diff --git a/Zend/tests/instanceof.phpt b/Zend/tests/instanceof.phpt index 97d67ff567..662185dcea 100644 --- a/Zend/tests/instanceof.phpt +++ b/Zend/tests/instanceof.phpt @@ -1,5 +1,5 @@ --TEST-- -instanceof shouldn't call __autoload +instanceof shouldn't call autoloader --FILE-- <?php spl_autoload_register(function ($name) { diff --git a/Zend/tests/instanceof_001.phpt b/Zend/tests/instanceof_001.phpt index 8c13a0478c..ae33dab4a5 100644 --- a/Zend/tests/instanceof_001.phpt +++ b/Zend/tests/instanceof_001.phpt @@ -8,7 +8,7 @@ var_dump($a instanceof stdClass); var_dump(new stdCLass instanceof stdClass); -$b = create_function('', 'return new stdClass;'); +$b = function() { return new stdClass; }; var_dump($b() instanceof stdClass); $c = array(new stdClass); @@ -22,8 +22,6 @@ var_dump("$a" instanceof stdClass); --EXPECTF-- bool(true) bool(true) - -Deprecated: Function create_function() is deprecated in %s on line %d bool(true) bool(true) bool(false) diff --git a/Zend/tests/is_a.phpt b/Zend/tests/is_a.phpt index 3714d50a62..f37c4638a8 100644 --- a/Zend/tests/is_a.phpt +++ b/Zend/tests/is_a.phpt @@ -1,5 +1,5 @@ --TEST-- -is_a() and is_subclass_of() shouldn't call __autoload +is_a() and is_subclass_of() shouldn't call autoloader --INI-- error_reporting=14335 --FILE-- diff --git a/Zend/tests/ns_041.phpt b/Zend/tests/ns_041.phpt index bd9dfbd093..3a2fe7758b 100644 --- a/Zend/tests/ns_041.phpt +++ b/Zend/tests/ns_041.phpt @@ -17,5 +17,7 @@ ok ok ok -Warning: Use of undefined constant BAR - assumed 'BAR' (this will throw an Error in a future version of PHP) in %sns_041.php on line 9 -BAR +Fatal error: Uncaught Error: Undefined constant 'test\ns1\BAR' in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/ns_076.phpt b/Zend/tests/ns_076.phpt index ea97e924b1..0db8aeba62 100644 --- a/Zend/tests/ns_076.phpt +++ b/Zend/tests/ns_076.phpt @@ -3,26 +3,28 @@ --FILE-- <?php namespace foo; +use Error; -$a = array(unknown => unknown); - -echo unknown; -echo "\n"; -var_dump($a); -echo \unknown; ---EXPECTF-- -Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d +try { + $a = array(unknown => unknown); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} -Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d +try { + echo unknown; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} -Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in %sns_076.php on line %d -unknown -array(1) { - ["unknown"]=> - %s(7) "unknown" +try { + echo \unknown; +} catch (Error $e) { + echo $e->getMessage(), "\n"; } -Fatal error: Uncaught Error: Undefined constant 'unknown' in %sns_076.php:%d -Stack trace: -#0 {main} - thrown in %sns_076.php on line %d +?> +--EXPECT-- +Undefined constant 'foo\unknown' +Undefined constant 'foo\unknown' +Undefined constant 'unknown' diff --git a/Zend/tests/objects_027.phpt b/Zend/tests/objects_027.phpt index 6ee7d5a491..b579278f2e 100644 --- a/Zend/tests/objects_027.phpt +++ b/Zend/tests/objects_027.phpt @@ -17,26 +17,12 @@ class foo extends bar { $foo = new foo; $foo->test(); -$foo::test(); call_user_func(array($foo, 'test')); -call_user_func(array('foo', 'test')); ?> --EXPECTF-- object(foo)#%d (0) { } - -Deprecated: Non-static method foo::test() should not be called statically in %s on line %d - -Deprecated: Non-static method bar::show() should not be called statically in %s on line %d -object(foo)#%d (0) { -} -object(foo)#%d (0) { -} - -Deprecated: %son-static method foo::test() should not be called statically in %s on line %d - -Deprecated: Non-static method bar::show() should not be called statically in %s on line %d object(foo)#%d (0) { } diff --git a/Zend/tests/parse_str_with_unpack.phpt b/Zend/tests/parse_str_with_unpack.phpt deleted file mode 100644 index 8daa711374..0000000000 --- a/Zend/tests/parse_str_with_unpack.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Calling parse_str through argument unpacking ---FILE-- -<?php - -function test() { - $i = 0; - parse_str(...["i=41"]); - var_dump($i + 1); -} -test(); - -?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d -int(42) diff --git a/Zend/tests/php_errormsg_misoptimization.phpt b/Zend/tests/php_errormsg_misoptimization.phpt deleted file mode 100644 index ae389db248..0000000000 --- a/Zend/tests/php_errormsg_misoptimization.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -The variable $php_errormsg shouldn't be optimized as it may be unpredictably modified ---INI-- -track_errors=1 ---FILE-- -<?php - -function test() { - $php_errormsg = 1; - echo $undef; - var_dump($php_errormsg + 1); -} -test(); - -?> ---EXPECTF-- -Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0 - -Notice: Undefined variable: undef in %s on line %d - -Warning: A non-numeric value encountered in %s on line %d -int(1) diff --git a/Zend/tests/return_types/023.phpt b/Zend/tests/return_types/023.phpt deleted file mode 100644 index e8e8732ef1..0000000000 --- a/Zend/tests/return_types/023.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -PHP 4 Constructors cannot declare a return type ---FILE-- -<?php - -class Foo { - function foo() : Foo {} -} ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Foo has a deprecated constructor in %s on line %d - -Fatal error: Constructor %s::%s() cannot declare a return type in %s on line %d diff --git a/Zend/tests/this_in_mb_parse_str.phpt b/Zend/tests/this_in_mb_parse_str.phpt deleted file mode 100644 index 2d5af4794e..0000000000 --- a/Zend/tests/this_in_mb_parse_str.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -$this re-assign in mb_parse_str() ---SKIPIF-- -<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> ---FILE-- -<?php -function foo() { - mb_parse_str("this=42"); - var_dump($this); -} -foo(); -?> ---EXPECTF-- -Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d - -Fatal error: Uncaught Error: Cannot re-assign $this in %sthis_in_mb_parse_str.php:3 -Stack trace: -#0 %sthis_in_mb_parse_str.php(3): mb_parse_str('this=42') -#1 %sthis_in_mb_parse_str.php(6): foo() -#2 {main} - thrown in %sthis_in_mb_parse_str.php on line 3 diff --git a/Zend/tests/this_in_parse_str.phpt b/Zend/tests/this_in_parse_str.phpt deleted file mode 100644 index 0bd9064d60..0000000000 --- a/Zend/tests/this_in_parse_str.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -$this re-assign in parse_str() ---FILE-- -<?php -function foo() { - parse_str("this=42"); - var_dump($this); -} -foo(); -?> ---EXPECTF-- -Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d - -Fatal error: Uncaught Error: Cannot re-assign $this in %sthis_in_parse_str.php:3 -Stack trace: -#0 %sthis_in_parse_str.php(3): parse_str('this=42') -#1 %sthis_in_parse_str.php(6): foo() -#2 {main} - thrown in %sthis_in_parse_str.php on line 3 diff --git a/Zend/tests/traits/bug55554a.phpt b/Zend/tests/traits/bug55554a.phpt deleted file mode 100644 index dd844ba661..0000000000 --- a/Zend/tests/traits/bug55554a.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// All constructors should be registered as such - -trait TConstructor { - public function constructor() { - echo "ctor executed\n"; - } -} - -class NewConstructor { - use TConstructor { - constructor as __construct; - } -} - -class LegacyConstructor { - use TConstructor { - constructor as LegacyConstructor; - } -} - -echo "New constructor: "; -$o = new NewConstructor; - -echo "Legacy constructor: "; -$o = new LegacyConstructor; ---EXPECT-- -New constructor: ctor executed -Legacy constructor: ctor executed diff --git a/Zend/tests/traits/bug55554b.phpt b/Zend/tests/traits/bug55554b.phpt deleted file mode 100644 index 65ecb7adaf..0000000000 --- a/Zend/tests/traits/bug55554b.phpt +++ /dev/null @@ -1,55 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -trait TConstructor { - public function foo() { - echo "foo executed\n"; - } - public function bar() { - echo "bar executed\n"; - } -} - -class OverridingIsSilent1 { - use TConstructor { - foo as __construct; - } - - public function __construct() { - echo "OverridingIsSilent1 __construct\n"; - } -} - -$o = new OverridingIsSilent1; - -class OverridingIsSilent2 { - use TConstructor { - foo as OverridingIsSilent2; - } - - public function OverridingIsSilent2() { - echo "OverridingIsSilent2 OverridingIsSilent2\n"; - } -} - -$o = new OverridingIsSilent2; - -class ReportCollision { - use TConstructor { - bar as ReportCollision; - foo as __construct; - } -} - - -echo "ReportCollision: "; -$o = new ReportCollision; ---EXPECTF-- -OverridingIsSilent1 __construct - -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OverridingIsSilent2 has a deprecated constructor in %s on line %d -OverridingIsSilent2 OverridingIsSilent2 - -Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d diff --git a/Zend/tests/traits/bug55554c.phpt b/Zend/tests/traits/bug55554c.phpt deleted file mode 100644 index 420689259e..0000000000 --- a/Zend/tests/traits/bug55554c.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Test that the behavior is consistent with the existing handling of new -// and legacy constructors. -// Here, the traits conflicts are overridden by local definitions, -// and the two constructor definitions do not directly collide in that case. - -trait TC1 { - public function __construct() { - echo "TC1 executed\n"; - } - public function ReportCollision() { - echo "TC1 executed\n"; - } -} - -trait TC2 { - public function __construct() { - echo "TC2 executed\n"; - } - public function ReportCollision() { - echo "TC1 executed\n"; - } -} - -class ReportCollision { - use TC1, TC2; - - public function __construct() { - echo "New constructor executed\n"; - } - public function ReportCollision() { - echo "Legacy constructor executed\n"; - } -} - - -echo "ReportCollision: "; -$o = new ReportCollision; ---EXPECT-- -ReportCollision: New constructor executed diff --git a/Zend/tests/traits/bug55554d.phpt b/Zend/tests/traits/bug55554d.phpt deleted file mode 100644 index 88564a83c1..0000000000 --- a/Zend/tests/traits/bug55554d.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Test mixed constructors from different traits, we are more strict about -// these cases, since that can lead to un-expected behavior. -// It is not consistent with the normal constructor handling, but -// here we have a chance to be more strict for the new traits. - -trait TNew { - public function __construct() { - echo "TNew executed\n"; - } -} - -trait TLegacy { - public function ReportCollision() { - echo "ReportCollision executed\n"; - } -} - -class ReportCollision { - use TNew, TLegacy; -} - -$o = new ReportCollision; ---EXPECTF-- -Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d diff --git a/Zend/tests/traits/bug55554e.phpt b/Zend/tests/traits/bug55554e.phpt deleted file mode 100644 index ed1c324831..0000000000 --- a/Zend/tests/traits/bug55554e.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Ensuring that the collision still occurs as expected. - -trait TC1 { - public function ReportCollision() { - echo "TC1 executed\n"; - } -} - -trait TC2 { - public function ReportCollision() { - echo "TC1 executed\n"; - } -} - -class ReportCollision { - use TC1, TC2; -} - - -echo "ReportCollision: "; -$o = new ReportCollision; ---EXPECTF-- -Fatal error: Trait method ReportCollision has not been applied, because there are collisions with other trait methods on ReportCollision in %s on line %d diff --git a/Zend/tests/traits/bug55554f.phpt b/Zend/tests/traits/bug55554f.phpt deleted file mode 100644 index d7d4fc007d..0000000000 --- a/Zend/tests/traits/bug55554f.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Ensuring that inconsistent constructor use results in an error to avoid -// problems creeping in. - -trait TNew { - public function __construct() { - echo "TNew executed\n"; - } -} - -class ReportCollision { - use TNew; - - public function ReportCollision() { - echo "ReportCollision executed\n"; - } -} - - -echo "ReportCollision: "; -$o = new ReportCollision; ---EXPECTF-- -Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d diff --git a/Zend/tests/traits/bug55554g.phpt b/Zend/tests/traits/bug55554g.phpt deleted file mode 100644 index d7de8216b0..0000000000 --- a/Zend/tests/traits/bug55554g.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Ensuring that inconsistent constructor use results in an error to avoid -// problems creeping in. - -trait TLegacy { - public function ReportCollision() { - echo "TLegacy executed\n"; - } -} - -class ReportCollision { - use TLegacy; - - public function __construct() { - echo "ReportCollision executed\n"; - } -} - - -echo "ReportCollision: "; -$o = new ReportCollision; ---EXPECTF-- -Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d diff --git a/Zend/tests/traits/noctor001.phpt b/Zend/tests/traits/noctor001.phpt deleted file mode 100644 index 19fe8dbd0d..0000000000 --- a/Zend/tests/traits/noctor001.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Don't mark trait methods as constructor ---FILE-- -<?php -trait Foo { - public function Foo() { - } -} - -class Bar { - use Foo; - public function Bar() { - } -} - -$rfoofoo = new ReflectionMethod('Foo::Foo'); -var_dump($rfoofoo->isConstructor()); - -$rbarfoo = new ReflectionMethod('Bar::Foo'); -var_dump($rbarfoo->isConstructor()); - -$rbarbar = new ReflectionMethod('Bar::Bar'); -var_dump($rbarbar->isConstructor()); -?> ---EXPECTF-- -Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Bar has a deprecated constructor in %s on line %d -bool(false) -bool(false) -bool(true) diff --git a/Zend/tests/type_declarations/callable_001.phpt b/Zend/tests/type_declarations/callable_001.phpt index 3113bedcf0..d93e70923a 100644 --- a/Zend/tests/type_declarations/callable_001.phpt +++ b/Zend/tests/type_declarations/callable_001.phpt @@ -14,19 +14,13 @@ $closure = function () {}; foo("strpos"); foo("foo"); -foo(array("bar", "baz")); -foo(array("bar", "foo")); foo($closure); +foo(array("bar", "foo")); +foo(array("bar", "baz")); --EXPECTF-- string(6) "strpos" string(3) "foo" - -Deprecated: Non-static method bar::baz() should not be called statically in %s on line %d -array(2) { - [0]=> - string(3) "bar" - [1]=> - string(3) "baz" +object(Closure)#1 (0) { } array(2) { [0]=> @@ -34,5 +28,9 @@ array(2) { [1]=> string(3) "foo" } -object(Closure)#%d (0) { -} + +Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be callable, array given, called in %s on line %d and defined in %s:%d +Stack trace: +#0 %s(%d): foo(Array) +#1 {main} + thrown in %s on line %d diff --git a/Zend/tests/unset_cast_deprecated.phpt b/Zend/tests/unset_cast_deprecated.phpt deleted file mode 100644 index 6744c85f02..0000000000 --- a/Zend/tests/unset_cast_deprecated.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -The (unset) cast is deprecated ---FILE-- -<?php - -$x = 1; -var_dump((unset) $x); -var_dump($x); - -?> ---EXPECTF-- -Deprecated: The (unset) cast is deprecated in %s on line %d -NULL -int(1) diff --git a/Zend/tests/unset_cast_removed.phpt b/Zend/tests/unset_cast_removed.phpt new file mode 100644 index 0000000000..9f2f798ed0 --- /dev/null +++ b/Zend/tests/unset_cast_removed.phpt @@ -0,0 +1,12 @@ +--TEST-- +The (unset) cast is removed +--FILE-- +<?php + +$x = 1; +var_dump((unset) $x); +var_dump($x); + +?> +--EXPECTF-- +Fatal error: The (unset) cast is no longer supported in %s on line %d diff --git a/Zend/zend.h b/Zend/zend.h index 31fd8ec5b4..421625fa7d 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -20,7 +20,7 @@ #ifndef ZEND_H #define ZEND_H -#define ZEND_VERSION "3.4.0-dev" +#define ZEND_VERSION "4.0.0-dev" #define ZEND_ENGINE_3 diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 0f3479cfe0..e524227156 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -315,17 +315,6 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha } /* }}} */ -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_deprecated(int num, char *error) /* {{{ */ -{ - const char *space; - const char *class_name = get_active_class_name(&space); - - zend_error(E_DEPRECATED, "%s%s%s() expects parameter %d to be a valid callback, %s", - class_name, space, get_active_function_name(), num, error); - efree(error); -} -/* }}} */ - ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, int num, int check_null) /* {{{ */ { zend_class_entry *ce_base = *pce; @@ -557,7 +546,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest } /* }}} */ -static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, const char **spec, char **error, int *severity) /* {{{ */ +static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, const char **spec, char **error) /* {{{ */ { const char *spec_walk = *spec; char c = *spec_walk++; @@ -768,23 +757,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons } if (zend_fcall_info_init(arg, 0, fci, fcc, NULL, &is_callable_error) == SUCCESS) { - if (is_callable_error) { - *severity = E_DEPRECATED; - zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); - efree(is_callable_error); - *spec = spec_walk; - return ""; - } + ZEND_ASSERT(!is_callable_error); break; + } + + if (is_callable_error) { + zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); + efree(is_callable_error); + return ""; } else { - if (is_callable_error) { - *severity = E_ERROR; - zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); - efree(is_callable_error); - return ""; - } else { - return "valid callback"; - } + return "valid callback"; } } @@ -813,9 +795,8 @@ static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec { const char *expected_type = NULL; char *error = NULL; - int severity = 0; - expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity); + expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error); if (expected_type) { if (!(flags & ZEND_PARSE_PARAMS_QUIET) && (*expected_type || error)) { const char *space; @@ -834,9 +815,7 @@ static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec zend_zval_type_name(arg)); } } - if (severity != E_DEPRECATED) { - return FAILURE; - } + return FAILURE; } return SUCCESS; @@ -2262,13 +2241,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio } if (scope) { - /* Look for ctor, dtor, clone - * If it's an old-style constructor, store it only if we don't have - * a constructor already. - */ - if ((fname_len == class_name_len) && !ctor && !memcmp(ZSTR_VAL(lowercase_name), lc_class_name, class_name_len+1)) { - ctor = reg_function; - } else if (ZSTR_VAL(lowercase_name)[0] != '_' || ZSTR_VAL(lowercase_name)[1] != '_') { + /* Look for ctor, dtor, clone */ + if (ZSTR_VAL(lowercase_name)[0] != '_' || ZSTR_VAL(lowercase_name)[1] != '_') { reg_function = NULL; } else if (zend_string_equals_literal(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME)) { ctor = reg_function; @@ -2343,25 +2317,21 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio if (ctor->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Constructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(ctor->common.function_name)); } - ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (dtor) { if (dtor->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Destructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(dtor->common.function_name)); } - dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (clone) { if (clone->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "%s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(clone->common.function_name)); } - clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__call) { if (__call->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__call->common.function_name)); } - __call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__callstatic) { if (!(__callstatic->common.fn_flags & ZEND_ACC_STATIC)) { @@ -2373,31 +2343,26 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio if (__tostring->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__tostring->common.function_name)); } - __tostring->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__get) { if (__get->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__get->common.function_name)); } - __get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__set) { if (__set->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__set->common.function_name)); } - __set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__unset) { if (__unset->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__unset->common.function_name)); } - __unset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__isset) { if (__isset->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__isset->common.function_name)); } - __isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__debugInfo) { if (__debugInfo->common.fn_flags & ZEND_ACC_STATIC) { @@ -3084,38 +3049,14 @@ get_function_via_handler: if (retval) { if (fcc->calling_scope && !call_via_handler) { if (fcc->function_handler->common.fn_flags & ZEND_ACC_ABSTRACT) { + retval = 0; if (error) { zend_spprintf(error, 0, "cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); - retval = 0; - } else { - zend_throw_error(NULL, "Cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); - retval = 0; } } else if (!fcc->object && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) { - int severity; - char *verb; - if (fcc->function_handler->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_DEPRECATED; - verb = "should not"; - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - severity = E_ERROR; - verb = "cannot"; - } - if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) { - retval = 0; - } + retval = 0; if (error) { - zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb); - if (severity != E_DEPRECATED) { - retval = 0; - } - } else if (retval) { - if (severity == E_ERROR) { - zend_throw_error(NULL, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb); - } else { - zend_error(severity, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb); - } + zend_spprintf(error, 0, "non-static method %s::%s() cannot be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); } } if (retval @@ -3371,7 +3312,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam { zend_fcall_info_cache fcc; - if (zend_is_callable_ex(callable, NULL, IS_CALLABLE_STRICT, callable_name, &fcc, NULL)) { + if (zend_is_callable_ex(callable, NULL, 0, callable_name, &fcc, NULL)) { if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) { zval_ptr_dtor_str(callable); array_init(callable); diff --git a/Zend/zend_API.h b/Zend/zend_API.h index ade5ef3332..7656c2aee1 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -297,11 +297,8 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void); #define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0) #define IS_CALLABLE_CHECK_NO_ACCESS (1<<1) -#define IS_CALLABLE_CHECK_IS_STATIC (1<<2) #define IS_CALLABLE_CHECK_SILENT (1<<3) -#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC) - ZEND_API zend_string *zend_get_callable_name_ex(zval *callable, zend_object *object); ZEND_API zend_string *zend_get_callable_name(zval *callable); ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint32_t check_flags, zend_string **callable_name, zend_fcall_info_cache *fcc, char **error); @@ -471,7 +468,6 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache; * fci->param_count = 0; * fci->params = NULL; * The callable_name argument may be NULL. - * Set check_flags to IS_CALLABLE_STRICT for every new usage! */ ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error); @@ -955,7 +951,6 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_exception(int nu ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error(int num, char *name, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_exception(int num, char *name, zval *arg); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(int num, char *error); -ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_deprecated(int num, char *error); ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, char *error); #define ZPP_ERROR_OK 0 @@ -1146,14 +1141,11 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception(int num, cha if (!_error) { \ _expected_type = Z_EXPECTED_FUNC; \ _error_code = ZPP_ERROR_WRONG_ARG; \ - break; \ } else { \ _error_code = ZPP_ERROR_WRONG_CALLBACK; \ - break; \ } \ - } else if (UNEXPECTED(_error != NULL)) { \ - zend_wrong_callback_deprecated(_i, _error); \ - } + break; \ + } \ #define Z_PARAM_FUNC_EX(dest_fci, dest_fcc, check_null, separate) \ Z_PARAM_FUNC_EX2(dest_fci, dest_fcc, check_null, separate, separate) diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 74f78c6fb0..0cd3e0c0fe 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -37,7 +37,6 @@ static ZEND_FUNCTION(strcmp); static ZEND_FUNCTION(strncmp); static ZEND_FUNCTION(strcasecmp); static ZEND_FUNCTION(strncasecmp); -static ZEND_FUNCTION(each); static ZEND_FUNCTION(error_reporting); static ZEND_FUNCTION(define); static ZEND_FUNCTION(defined); @@ -67,7 +66,6 @@ static ZEND_FUNCTION(get_declared_traits); static ZEND_FUNCTION(get_declared_interfaces); static ZEND_FUNCTION(get_defined_functions); static ZEND_FUNCTION(get_defined_vars); -static ZEND_FUNCTION(create_function); static ZEND_FUNCTION(get_resource_type); static ZEND_FUNCTION(get_resources); static ZEND_FUNCTION(get_loaded_extensions); @@ -109,10 +107,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_strncmp, 0, 0, 3) ZEND_ARG_INFO(0, len) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_each, 0, 0, 1) - ZEND_ARG_INFO(1, arr) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_error_reporting, 0, 0, 0) ZEND_ARG_INFO(0, new_error_level) ZEND_END_ARG_INFO() @@ -197,11 +191,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_get_defined_functions, 0, 0, 0) ZEND_ARG_INFO(0, exclude_disabled) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_create_function, 0, 0, 2) - ZEND_ARG_INFO(0, args) - ZEND_ARG_INFO(0, code) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_get_resource_type, 0, 0, 1) ZEND_ARG_INFO(0, res) ZEND_END_ARG_INFO() @@ -244,7 +233,6 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */ ZEND_FE(strncmp, arginfo_strncmp) ZEND_FE(strcasecmp, arginfo_strcmp) ZEND_FE(strncasecmp, arginfo_strncmp) - ZEND_FE(each, arginfo_each) ZEND_FE(error_reporting, arginfo_error_reporting) ZEND_FE(define, arginfo_define) ZEND_FE(defined, arginfo_defined) @@ -276,7 +264,6 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */ ZEND_FE(get_declared_interfaces, arginfo_zend__void) ZEND_FE(get_defined_functions, arginfo_get_defined_functions) ZEND_FE(get_defined_vars, arginfo_zend__void) - ZEND_DEP_FE(create_function, arginfo_create_function) ZEND_FE(get_resource_type, arginfo_get_resource_type) ZEND_FE(get_resources, arginfo_get_resources) ZEND_FE(get_loaded_extensions, arginfo_get_loaded_extensions) @@ -660,66 +647,6 @@ ZEND_FUNCTION(strncasecmp) } /* }}} */ -/* {{{ proto mixed each(array &arr) - Return the currently pointed key..value pair in the passed array, and advance the pointer to the next element, or false if there is no element at this place */ -ZEND_FUNCTION(each) -{ - zval *array, *entry, tmp; - zend_ulong num_key; - HashTable *target_hash; - zend_string *key; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z/", &array) == FAILURE) { - return; - } - - if (!EG(each_deprecation_thrown)) { - zend_error(E_DEPRECATED, "The each() function is deprecated. This message will be suppressed on further calls"); - EG(each_deprecation_thrown) = 1; - } - - target_hash = HASH_OF(array); - if (!target_hash) { - zend_error(E_WARNING,"Variable passed to each() is not an array or object"); - return; - } - while (1) { - entry = zend_hash_get_current_data(target_hash); - if (!entry) { - RETURN_FALSE; - } else if (Z_TYPE_P(entry) == IS_INDIRECT) { - entry = Z_INDIRECT_P(entry); - if (Z_TYPE_P(entry) == IS_UNDEF) { - zend_hash_move_forward(target_hash); - continue; - } - } - break; - } - array_init_size(return_value, 4); - zend_hash_real_init_mixed(Z_ARRVAL_P(return_value)); - - /* add value elements */ - ZVAL_DEREF(entry); - if (Z_REFCOUNTED_P(entry)) { - GC_ADDREF_EX(Z_COUNTED_P(entry), 2); - } - zend_hash_index_add_new(Z_ARRVAL_P(return_value), 1, entry); - zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_VALUE), entry); - - /* add the key elements */ - if (zend_hash_get_current_key(target_hash, &key, &num_key) == HASH_KEY_IS_STRING) { - ZVAL_STR_COPY(&tmp, key); - Z_TRY_ADDREF(tmp); - } else { - ZVAL_LONG(&tmp, num_key); - } - zend_hash_index_add_new(Z_ARRVAL_P(return_value), 0, &tmp); - zend_hash_add_new(Z_ARRVAL_P(return_value), ZSTR_KNOWN(ZEND_STR_KEY), &tmp); - zend_hash_move_forward(target_hash); -} -/* }}} */ - /* {{{ proto int error_reporting([int new_error_level]) Return the current error_reporting level, and if an argument was passed - change to the new level */ ZEND_FUNCTION(error_reporting) @@ -838,7 +765,6 @@ ZEND_FUNCTION(define) zend_string *name; zval *val, val_free; zend_bool non_cs = 0; - int case_sensitive = CONST_CS; zend_constant c; ZEND_PARSE_PARAMETERS_START(2, 3) @@ -848,15 +774,17 @@ ZEND_FUNCTION(define) Z_PARAM_BOOL(non_cs) ZEND_PARSE_PARAMETERS_END(); - if (non_cs) { - case_sensitive = 0; - } - if (zend_memnstr(ZSTR_VAL(name), "::", sizeof("::") - 1, ZSTR_VAL(name) + ZSTR_LEN(name))) { zend_error(E_WARNING, "Class constants cannot be defined or redefined"); RETURN_FALSE; } + if (non_cs) { + zend_error(E_WARNING, + "define(): Declaration of case-insensitive constants is no longer supported"); + RETURN_FALSE; + } + ZVAL_UNDEF(&val_free); repeat: @@ -904,13 +832,8 @@ repeat: zval_ptr_dtor(&val_free); register_constant: - if (non_cs) { - zend_error(E_DEPRECATED, - "define(): Declaration of case-insensitive constants is deprecated"); - } - /* non persistent */ - ZEND_CONSTANT_SET_FLAGS(&c, case_sensitive, PHP_USER_CONSTANT); + ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, PHP_USER_CONSTANT); c.name = zend_string_copy(name); if (zend_register_constant(&c) == SUCCESS) { RETURN_TRUE; @@ -931,7 +854,7 @@ ZEND_FUNCTION(defined) Z_PARAM_STR(name) ZEND_PARSE_PARAMETERS_END(); - if (zend_get_constant_ex(name, zend_get_executed_scope(), ZEND_FETCH_CLASS_SILENT | ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK)) { + if (zend_get_constant_ex(name, zend_get_executed_scope(), ZEND_FETCH_CLASS_SILENT)) { RETURN_TRUE; } else { RETURN_FALSE; @@ -1895,78 +1818,6 @@ ZEND_FUNCTION(get_defined_vars) } /* }}} */ -#define LAMBDA_TEMP_FUNCNAME "__lambda_func" -/* {{{ proto string create_function(string args, string code) - Creates an anonymous function, and returns its name (funny, eh?) */ -ZEND_FUNCTION(create_function) -{ - zend_string *function_name; - char *eval_code, *function_args, *function_code; - size_t eval_code_length, function_args_len, function_code_len; - int retval; - char *eval_name; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &function_args, &function_args_len, &function_code, &function_code_len) == FAILURE) { - return; - } - - eval_code = (char *) emalloc(sizeof("function " LAMBDA_TEMP_FUNCNAME) - +function_args_len - +2 /* for the args parentheses */ - +2 /* for the curly braces */ - +function_code_len); - - eval_code_length = sizeof("function " LAMBDA_TEMP_FUNCNAME "(") - 1; - memcpy(eval_code, "function " LAMBDA_TEMP_FUNCNAME "(", eval_code_length); - - memcpy(eval_code + eval_code_length, function_args, function_args_len); - eval_code_length += function_args_len; - - eval_code[eval_code_length++] = ')'; - eval_code[eval_code_length++] = '{'; - - memcpy(eval_code + eval_code_length, function_code, function_code_len); - eval_code_length += function_code_len; - - eval_code[eval_code_length++] = '}'; - eval_code[eval_code_length] = '\0'; - - eval_name = zend_make_compiled_string_description("runtime-created function"); - retval = zend_eval_stringl(eval_code, eval_code_length, NULL, eval_name); - efree(eval_code); - efree(eval_name); - - if (retval==SUCCESS) { - zend_op_array *func; - HashTable *static_variables; - - func = zend_hash_str_find_ptr(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1); - if (!func) { - zend_error_noreturn(E_CORE_ERROR, "Unexpected inconsistency in create_function()"); - RETURN_FALSE; - } - if (func->refcount) { - (*func->refcount)++; - } - static_variables = func->static_variables; - func->static_variables = NULL; - zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1); - func->static_variables = static_variables; - - function_name = zend_string_alloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0); - ZSTR_VAL(function_name)[0] = '\0'; - - do { - ZSTR_LEN(function_name) = snprintf(ZSTR_VAL(function_name) + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1; - } while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL); - RETURN_NEW_STR(function_name); - } else { - zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1); - RETURN_FALSE; - } -} -/* }}} */ - #if ZEND_DEBUG && defined(ZTS) ZEND_FUNCTION(zend_thread_id) { diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index ab042bcbd4..f263c2a555 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -84,12 +84,8 @@ static zend_bool zend_valid_closure_binding( } } else if (is_fake_closure && func->common.scope && !(func->common.fn_flags & ZEND_ACC_STATIC)) { - if (func->type == ZEND_INTERNAL_FUNCTION) { - zend_error(E_WARNING, "Cannot unbind $this of internal method"); - return 0; - } else { - zend_error(E_DEPRECATED, "Unbinding $this of a method is deprecated"); - } + zend_error(E_WARNING, "Cannot unbind $this of method"); + return 0; } if (scope && scope != func->common.scope && scope->type == ZEND_INTERNAL_CLASS) { @@ -323,7 +319,7 @@ ZEND_METHOD(Closure, fromCallable) success = zend_create_closure_from_callable(return_value, callable, &error); EG(current_execute_data) = execute_data; - if (success == FAILURE || error) { + if (success == FAILURE) { if (error) { zend_type_error("Failed to create closure from callable: %s", error); efree(error); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1eeece3c42..b56356660b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -585,10 +585,6 @@ static int zend_add_const_name_literal(zend_string *name, zend_bool unqualified) zend_str_tolower(ZSTR_VAL(tmp_name), ns_len); zend_add_literal_string(&tmp_name); - /* lowercased namespace name & lowercased constant name */ - tmp_name = zend_string_tolower(name); - zend_add_literal_string(&tmp_name); - if (!unqualified) { return ret; } @@ -600,11 +596,6 @@ static int zend_add_const_name_literal(zend_string *name, zend_bool unqualified) tmp_name = zend_string_init(after_ns, after_ns_len, 0); zend_add_literal_string(&tmp_name); - /* lowercased unqualified constant name */ - tmp_name = zend_string_alloc(after_ns_len, 0); - zend_str_tolower_copy(ZSTR_VAL(tmp_name), after_ns, after_ns_len); - zend_add_literal_string(&tmp_name); - return ret; } /* }}} */ @@ -1213,22 +1204,9 @@ ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char } /* }}} */ -static zend_constant *zend_lookup_reserved_const(const char *name, size_t len) /* {{{ */ -{ - zend_constant *c = zend_hash_find_ptr_lc(EG(zend_constants), name, len); - if (c && !(ZEND_CONSTANT_FLAGS(c) & CONST_CS) && (ZEND_CONSTANT_FLAGS(c) & CONST_CT_SUBST)) { - return c; - } - return NULL; -} -/* }}} */ - static zend_bool zend_try_ct_eval_const(zval *zv, zend_string *name, zend_bool is_fully_qualified) /* {{{ */ { - zend_constant *c; - - /* Substitute case-sensitive (or lowercase) constants */ - c = zend_hash_find_ptr(EG(zend_constants), name); + zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name); if (c && ( ((ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) && !(CG(compiler_options) & ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION) @@ -1243,19 +1221,19 @@ static zend_bool zend_try_ct_eval_const(zval *zv, zend_string *name, zend_bool i /* Substitute true, false and null (including unqualified usage in namespaces) */ const char *lookup_name = ZSTR_VAL(name); size_t lookup_len = ZSTR_LEN(name); + zval *val; if (!is_fully_qualified) { zend_get_unqualified_name(name, &lookup_name, &lookup_len); } - c = zend_lookup_reserved_const(lookup_name, lookup_len); - if (c) { - ZVAL_COPY_OR_DUP(zv, &c->value); + if ((val = zend_get_special_const(lookup_name, lookup_len))) { + ZVAL_COPY_VALUE(zv, val); return 1; } - } - return 0; + return 0; + } } /* }}} */ @@ -3169,9 +3147,7 @@ int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ { znode arg_node; - if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) - || args->children != 1 - ) { + if (args->children != 1) { return FAILURE; } @@ -3251,13 +3227,6 @@ int zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ LITERAL_STR(opline->op1, name); opline->extended_value = zend_alloc_cache_slot(); - /* Lowercase constant name in a separate literal */ - { - zval c; - zend_string *lcname = zend_string_tolower(name); - ZVAL_NEW_STR(&c, lcname); - zend_add_literal(&c); - } return SUCCESS; } /* }}} */ @@ -5541,7 +5510,6 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo { zend_class_entry *ce = CG(active_class_entry); zend_bool in_interface = (ce->ce_flags & ZEND_ACC_INTERFACE) != 0; - zend_bool in_trait = (ce->ce_flags & ZEND_ACC_TRAIT) != 0; zend_bool is_public = (op_array->fn_flags & ZEND_ACC_PUBLIC) != 0; zend_bool is_static = (op_array->fn_flags & ZEND_ACC_STATIC) != 0; @@ -5632,16 +5600,8 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo "public visibility and cannot be static"); } } - } else { - if (!in_trait && zend_string_equals_ci(lcname, ce->name)) { - if (!ce->constructor) { - ce->constructor = (zend_function *) op_array; - } - } else if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') { - if (!is_static) { - op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC; - } - } else if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) { + } else if (ZSTR_VAL(lcname)[0] == '_' && ZSTR_VAL(lcname)[1] == '_') { + if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) { ce->constructor = (zend_function *) op_array; } else if (zend_string_equals_literal(lcname, ZEND_DESTRUCTOR_FUNC_NAME)) { ce->destructor = (zend_function *) op_array; @@ -5704,8 +5664,6 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo "public visibility and cannot be static"); } ce->__debugInfo = (zend_function *) op_array; - } else if (!is_static) { - op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC; } } @@ -5715,7 +5673,6 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_ast_decl *decl, zend_bool toplevel) /* {{{ */ { - zend_ast *params_ast = decl->child[0]; zend_string *unqualified_name, *name, *lcname, *key; zend_op *opline; @@ -5732,18 +5689,14 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as } } - if (zend_string_equals_literal(lcname, ZEND_AUTOLOAD_FUNC_NAME)) { - if (zend_ast_get_list(params_ast)->children != 1) { - zend_error_noreturn(E_COMPILE_ERROR, "%s() must take exactly 1 argument", - ZEND_AUTOLOAD_FUNC_NAME); - } - - zend_error(E_DEPRECATED, "__autoload() is deprecated, use spl_autoload_register() instead"); + if (zend_string_equals_literal(lcname, "__autoload")) { + zend_error_noreturn(E_COMPILE_ERROR, + "__autoload() is no longer supported, use spl_autoload_register() instead"); } if (zend_string_equals_literal_ci(unqualified_name, "assert")) { - zend_error(E_DEPRECATED, - "Defining a custom assert() function is deprecated, " + zend_error(E_COMPILE_ERROR, + "Defining a custom assert() function is not allowed, " "as the function has special semantics"); } @@ -6255,11 +6208,6 @@ void zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */ /* Reset lineno for final opcodes and errors */ CG(zend_lineno) = ast->lineno; - if (!(ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS)) { - /* For traits this check is delayed until after trait binding */ - zend_check_deprecated_constructor(ce); - } - if (ce->constructor) { if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) { zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static", @@ -6561,7 +6509,7 @@ void zend_compile_const_decl(zend_ast *ast) /* {{{ */ value_node.op_type = IS_CONST; zend_const_expr_to_zval(value_zv, value_ast); - if (zend_lookup_reserved_const(ZSTR_VAL(unqualified_name), ZSTR_LEN(unqualified_name))) { + if (zend_get_special_const(ZSTR_VAL(unqualified_name), ZSTR_LEN(unqualified_name))) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", ZSTR_VAL(unqualified_name)); } @@ -7186,7 +7134,7 @@ void zend_compile_cast(znode *result, zend_ast *ast) /* {{{ */ opline->extended_value = ast->attr; if (ast->attr == IS_NULL) { - zend_error(E_DEPRECATED, "The (unset) cast is deprecated"); + zend_error(E_COMPILE_ERROR, "The (unset) cast is no longer supported"); } } /* }}} */ @@ -7695,19 +7643,13 @@ void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */ opline = zend_emit_op_tmp(result, ZEND_FETCH_CONSTANT, NULL, NULL); opline->op2_type = IS_CONST; - if (is_fully_qualified) { + if (is_fully_qualified || !FC(current_namespace)) { opline->op2.constant = zend_add_const_name_literal( resolved_name, 0); } else { - opline->op1.num = IS_CONSTANT_UNQUALIFIED; - if (FC(current_namespace)) { - opline->op1.num |= IS_CONSTANT_IN_NAMESPACE; - opline->op2.constant = zend_add_const_name_literal( - resolved_name, 1); - } else { - opline->op2.constant = zend_add_const_name_literal( - resolved_name, 0); - } + opline->op1.num = IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE; + opline->op2.constant = zend_add_const_name_literal( + resolved_name, 1); } opline->extended_value = zend_alloc_cache_slot(); } @@ -8037,7 +7979,8 @@ void zend_compile_const_expr_const(zend_ast **ast_ptr) /* {{{ */ } zend_ast_destroy(ast); - *ast_ptr = zend_ast_create_constant(resolved_name, !is_fully_qualified ? IS_CONSTANT_UNQUALIFIED : 0); + *ast_ptr = zend_ast_create_constant(resolved_name, + !is_fully_qualified && FC(current_namespace) ? IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE : 0); } /* }}} */ diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 626104deeb..833139eafc 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -282,10 +282,6 @@ typedef struct _zend_oparray_context { /* ZEND_DECLARE_INHERITED_CLASS_DELAYED opcodes | | | */ #define ZEND_ACC_EARLY_BINDING (1 << 15) /* | X | | */ /* | | | */ -/* method flag (bc only), any method that has this | | | */ -/* flag can be used statically and non statically. | | | */ -#define ZEND_ACC_ALLOW_STATIC (1 << 16) /* | X | | */ -/* | | | */ /* call through user function trampoline. e.g. | | | */ /* __call, __callstatic | | | */ #define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 17) /* | X | | */ @@ -921,9 +917,8 @@ void zend_assert_valid_class_name(const zend_string *const_name); #define ZEND_DIM_IS 1 -#define IS_CONSTANT_UNQUALIFIED 0x010 #define IS_CONSTANT_CLASS 0x080 /* __CLASS__ in trait */ -#define IS_CONSTANT_IN_NAMESPACE 0x100 +#define IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE 0x100 static zend_always_inline int zend_check_arg_send_type(const zend_function *zf, uint32_t arg_num, uint32_t mask) { @@ -1008,7 +1003,6 @@ END_EXTERN_C() #define ZEND_CALL_FUNC_NAME "__call" #define ZEND_CALLSTATIC_FUNC_NAME "__callstatic" #define ZEND_TOSTRING_FUNC_NAME "__tostring" -#define ZEND_AUTOLOAD_FUNC_NAME "__autoload" #define ZEND_INVOKE_FUNC_NAME "__invoke" #define ZEND_DEBUGINFO_FUNC_NAME "__debuginfo" @@ -1035,9 +1029,6 @@ END_EXTERN_C() /* disable constant substitution at compile-time */ #define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION (1<<5) -/* disable usage of builtin instruction for strlen() */ -#define ZEND_COMPILE_NO_BUILTIN_STRLEN (1<<6) - /* disable substitution of persistent constants at compile-time */ #define ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION (1<<7) diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index 0f3fb9cfa0..e38dc61fff 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -33,6 +33,9 @@ #define MARK_CONSTANT_VISITED(zv) Z_ACCESS_FLAGS_P(zv) |= IS_CONSTANT_VISITED_MARK #define RESET_CONSTANT_VISITED(zv) Z_ACCESS_FLAGS_P(zv) &= ~IS_CONSTANT_VISITED_MARK +/* Use for special null/true/false constants. */ +static zval null_value, true_value, false_value; + void free_zend_constant(zval *zv) { zend_constant *c = Z_PTR_P(zv); @@ -99,7 +102,6 @@ void clean_module_constants(int module_number) int zend_startup_constants(void) { EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init(EG(zend_constants), 128, NULL, ZEND_CONSTANT_DTOR, 1); return SUCCESS; } @@ -128,14 +130,17 @@ void zend_register_standard_constants(void) REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_PROVIDE_OBJECT", DEBUG_BACKTRACE_PROVIDE_OBJECT, CONST_PERSISTENT | CONST_CS); REGISTER_MAIN_LONG_CONSTANT("DEBUG_BACKTRACE_IGNORE_ARGS", DEBUG_BACKTRACE_IGNORE_ARGS, CONST_PERSISTENT | CONST_CS); - /* true/false constants */ - { - REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT | CONST_CT_SUBST); - REGISTER_MAIN_BOOL_CONSTANT("FALSE", 0, CONST_PERSISTENT | CONST_CT_SUBST); - REGISTER_MAIN_BOOL_CONSTANT("ZEND_THREAD_SAFE", ZTS_V, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_BOOL_CONSTANT("ZEND_DEBUG_BUILD", ZEND_DEBUG, CONST_PERSISTENT | CONST_CS); - } - REGISTER_MAIN_NULL_CONSTANT("NULL", CONST_PERSISTENT | CONST_CT_SUBST); + REGISTER_MAIN_BOOL_CONSTANT("ZEND_THREAD_SAFE", ZTS_V, CONST_PERSISTENT | CONST_CS); + REGISTER_MAIN_BOOL_CONSTANT("ZEND_DEBUG_BUILD", ZEND_DEBUG, CONST_PERSISTENT | CONST_CS); + + /* Special constants true/false/null. */ + REGISTER_MAIN_BOOL_CONSTANT("TRUE", 1, CONST_PERSISTENT); + REGISTER_MAIN_BOOL_CONSTANT("FALSE", 0, CONST_PERSISTENT); + REGISTER_MAIN_NULL_CONSTANT("NULL", CONST_PERSISTENT); + + ZVAL_NULL(&null_value); + ZVAL_TRUE(&true_value); + ZVAL_FALSE(&false_value); } @@ -204,7 +209,7 @@ ZEND_API void zend_register_string_constant(const char *name, size_t name_len, c zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number); } -static zend_constant *zend_get_special_constant(const char *name, size_t name_len) +static zend_constant *zend_get_halt_offset_constant(const char *name, size_t name_len) { zend_constant *c; static const char haltoff[] = "__COMPILER_HALT_OFFSET__"; @@ -230,6 +235,37 @@ static zend_constant *zend_get_special_constant(const char *name, size_t name_le } } +ZEND_API zval *_zend_get_special_const(const char *name, size_t len) /* {{{ */ +{ + if (len == 4) { + if ((name[0] == 'n' || name[0] == 'N') && + (name[1] == 'u' || name[1] == 'U') && + (name[2] == 'l' || name[2] == 'L') && + (name[3] == 'l' || name[3] == 'L') + ) { + return &null_value; + } + if ((name[0] == 't' || name[0] == 'T') && + (name[1] == 'r' || name[1] == 'R') && + (name[2] == 'u' || name[2] == 'U') && + (name[3] == 'e' || name[3] == 'E') + ) { + return &true_value; + } + } else { + if ((name[0] == 'f' || name[0] == 'F') && + (name[1] == 'a' || name[1] == 'A') && + (name[2] == 'l' || name[2] == 'L') && + (name[3] == 's' || name[3] == 'S') && + (name[4] == 'e' || name[4] == 'E') + ) { + return &false_value; + } + } + return 0; +} +/* }}} */ + ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry *scope) /* {{{ */ { if (Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PUBLIC) { @@ -243,80 +279,34 @@ ZEND_API int zend_verify_const_access(zend_class_constant *c, zend_class_entry * } /* }}} */ -static inline zend_constant *zend_get_constant_str_impl(const char *name, size_t name_len) -{ - zend_constant *c; - ALLOCA_FLAG(use_heap) - - if ((c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len)) == NULL) { - char *lcname = do_alloca(name_len + 1, use_heap); - zend_str_tolower_copy(lcname, name, name_len); - if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, name_len)) != NULL) { - if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) { - c = NULL; - } - } else { - c = zend_get_special_constant(name, name_len); - } - free_alloca(lcname, use_heap); - } - - return c; -} - ZEND_API zval *zend_get_constant_str(const char *name, size_t name_len) { - zend_constant *c = zend_get_constant_str_impl(name, name_len); - return c ? &c->value : NULL; -} + zend_constant *c = zend_hash_str_find_ptr(EG(zend_constants), name, name_len); + if (c) { + return &c->value; + } -static inline zend_constant *zend_get_constant_impl(zend_string *name) -{ - zval *zv; - zend_constant *c; - ALLOCA_FLAG(use_heap) - - zv = zend_hash_find(EG(zend_constants), name); - if (zv == NULL) { - char *lcname = do_alloca(ZSTR_LEN(name) + 1, use_heap); - zend_str_tolower_copy(lcname, ZSTR_VAL(name), ZSTR_LEN(name)); - zv = zend_hash_str_find(EG(zend_constants), lcname, ZSTR_LEN(name)); - if (zv != NULL) { - c = Z_PTR_P(zv); - if (ZEND_CONSTANT_FLAGS(c) & CONST_CS) { - c = NULL; - } - } else { - c = zend_get_special_constant(ZSTR_VAL(name), ZSTR_LEN(name)); - } - free_alloca(lcname, use_heap); - return c; - } else { - return (zend_constant *) Z_PTR_P(zv); + c = zend_get_halt_offset_constant(name, name_len); + if (c) { + return &c->value; } + + return zend_get_special_const(name, name_len); } ZEND_API zval *zend_get_constant(zend_string *name) { - zend_constant *c = zend_get_constant_impl(name); - return c ? &c->value : NULL; -} + zend_constant *c = zend_hash_find_ptr(EG(zend_constants), name); + if (c) { + return &c->value; + } -static zend_bool is_access_deprecated(const zend_constant *c, const char *access_name) { - const char *ns_sep = zend_memrchr(ZSTR_VAL(c->name), '\\', ZSTR_LEN(c->name)); - if (ns_sep) { - /* Namespaces are always case-insensitive. Only compare shortname. */ - size_t shortname_offset = ns_sep - ZSTR_VAL(c->name) + 1; - size_t shortname_len = ZSTR_LEN(c->name) - shortname_offset; - return memcmp( - access_name + shortname_offset, - ZSTR_VAL(c->name) + shortname_offset, - shortname_len - ) != 0; - } else { - /* No namespace, compare whole name */ - return memcmp(access_name, ZSTR_VAL(c->name), ZSTR_LEN(c->name)) != 0; + c = zend_get_halt_offset_constant(ZSTR_VAL(name), ZSTR_LEN(name)); + if (c) { + return &c->value; } + + return zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name)); } ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, uint32_t flags) @@ -419,56 +409,34 @@ failure: size_t lcname_len; ALLOCA_FLAG(use_heap) + /* Lowercase the namespace portion */ lcname_len = prefix_len + 1 + const_name_len; lcname = do_alloca(lcname_len + 1, use_heap); zend_str_tolower_copy(lcname, name, prefix_len); - /* Check for namespace constant */ lcname[prefix_len] = '\\'; memcpy(lcname + prefix_len + 1, constant_name, const_name_len + 1); - if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len)) == NULL) { - /* try lowercase */ - zend_str_tolower(lcname + prefix_len + 1, const_name_len); - if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len)) != NULL) { - if ((ZEND_CONSTANT_FLAGS(c) & CONST_CS) != 0) { - c = NULL; - } - } - } + c = zend_hash_str_find_ptr(EG(zend_constants), lcname, lcname_len); free_alloca(lcname, use_heap); - if (!c) { - if (!(flags & IS_CONSTANT_UNQUALIFIED)) { - return NULL; - } + if (c) { + return &c->value; + } - /* name requires runtime resolution, need to check non-namespaced name */ - c = zend_get_constant_str_impl(constant_name, const_name_len); - name = constant_name; + if (!(flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE)) { + return NULL; } + + /* name requires runtime resolution, need to check non-namespaced name */ + return zend_get_constant_str(constant_name, const_name_len); } else { if (cname) { - c = zend_get_constant_impl(cname); + return zend_get_constant(cname); } else { - c = zend_get_constant_str_impl(name, name_len); - } - } - - if (!c) { - return NULL; - } - - if (!(flags & ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK)) { - if (!(ZEND_CONSTANT_FLAGS(c) & (CONST_CS|CONST_CT_SUBST)) && is_access_deprecated(c, name)) { - zend_error(E_DEPRECATED, - "Case-insensitive constants are deprecated. " - "The correct casing for this constant is \"%s\"", - ZSTR_VAL(c->name)); + return zend_get_constant_str(name, name_len); } } - - return &c->value; } static void* zend_hash_add_constant(HashTable *ht, zend_string *key, zend_constant *c) @@ -489,38 +457,30 @@ ZEND_API int zend_register_constant(zend_constant *c) zend_string *lowercase_name = NULL; zend_string *name; int ret = SUCCESS; + zend_bool persistent = (ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT) != 0; #if 0 printf("Registering constant for module %d\n", c->module_number); #endif - if (!(ZEND_CONSTANT_FLAGS(c) & CONST_CS)) { - lowercase_name = zend_string_tolower_ex(c->name, ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); + char *slash = strrchr(ZSTR_VAL(c->name), '\\'); + if (slash) { + lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), persistent); + zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name)); lowercase_name = zend_new_interned_string(lowercase_name); name = lowercase_name; } else { - char *slash = strrchr(ZSTR_VAL(c->name), '\\'); - if (slash) { - lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT); - zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name)); - lowercase_name = zend_new_interned_string(lowercase_name); - name = lowercase_name; - } else { - name = c->name; - } + name = c->name; } - /* Check if the user is trying to define the internal pseudo constant name __COMPILER_HALT_OFFSET__ */ + /* Check if the user is trying to define any special constant */ if (zend_string_equals_literal(name, "__COMPILER_HALT_OFFSET__") - || zend_hash_add_constant(EG(zend_constants), name, c) == NULL) { - - /* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */ - if (ZSTR_VAL(c->name)[0] == '\0' && ZSTR_LEN(c->name) > sizeof("\0__COMPILER_HALT_OFFSET__")-1 - && memcmp(ZSTR_VAL(name), "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) { - } + || (!persistent && zend_get_special_const(ZSTR_VAL(name), ZSTR_LEN(name))) + || zend_hash_add_constant(EG(zend_constants), name, c) == NULL + ) { zend_error(E_NOTICE,"Constant %s already defined", ZSTR_VAL(name)); zend_string_release(c->name); - if (!(ZEND_CONSTANT_FLAGS(c) & CONST_PERSISTENT)) { + if (!persistent) { zval_ptr_dtor_nogc(&c->value); } ret = FAILURE; diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h index fec4f294e9..66c9e1c63c 100644 --- a/Zend/zend_constants.h +++ b/Zend/zend_constants.h @@ -22,16 +22,12 @@ #include "zend_globals.h" -#define CONST_CS (1<<0) /* Case Sensitive */ -#define CONST_PERSISTENT (1<<1) /* Persistent */ -#define CONST_CT_SUBST (1<<2) /* Allow compile-time substitution */ -#define CONST_NO_FILE_CACHE (1<<3) /* Can't be saved in file cache */ +#define CONST_CS 0 /* No longer used -- always case sensitive */ +#define CONST_PERSISTENT (1<<0) /* Persistent */ +#define CONST_NO_FILE_CACHE (1<<1) /* Can't be saved in file cache */ #define PHP_USER_CONSTANT 0x7fffff /* a constant defined in user space */ -/* Flag for zend_get_constant_ex(). Must not class with ZEND_FETCH_CLASS_* flags. */ -#define ZEND_GET_CONSTANT_NO_DEPRECATION_CHECK 0x1000 - typedef struct _zend_constant { zval value; zend_string *name; @@ -89,6 +85,16 @@ ZEND_API int zend_register_constant(zend_constant *c); #ifdef ZTS void zend_copy_constants(HashTable *target, HashTable *sourc); #endif + +ZEND_API zval *_zend_get_special_const(const char *name, size_t name_len); + +static zend_always_inline zval *zend_get_special_const(const char *name, size_t name_len) { + if (name_len == 4 || name_len == 5) { + return _zend_get_special_const(name, name_len); + } + return NULL; +} + END_EXTERN_C() #define ZEND_CONSTANT_DTOR free_zend_constant diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 2b832b6f0d..519b295cca 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1969,16 +1969,10 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_invalid_method_call(z static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_non_static_method_call(const zend_function *fbc) { - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, - "Non-static method %s::%s() should not be called statically", - ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); - } else { - zend_throw_error( - zend_ce_error, - "Non-static method %s::%s() cannot be called statically", - ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); - } + zend_throw_error( + zend_ce_error, + "Non-static method %s::%s() cannot be called statically", + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(const zend_function *func, uint32_t arg_num) @@ -3829,9 +3823,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s if (UNEXPECTED(!(fbc->common.fn_flags & ZEND_ACC_STATIC))) { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - return NULL; - } + return NULL; } if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) { init_func_run_time_cache(&fbc->op_array); @@ -3947,9 +3939,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar } if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - return NULL; - } + return NULL; } } else { called_scope = Z_OBJCE_P(obj); @@ -4157,96 +4147,30 @@ static zend_always_inline int _zend_quick_get_constant( const zval *key, uint32_t flags, int check_defined_only OPLINE_DC EXECUTE_DATA_DC) /* {{{ */ { zval *zv; - const zval *orig_key = key; zend_constant *c = NULL; + /* null/true/false are resolved during compilation, so don't check for them here. */ zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1); if (zv) { c = (zend_constant*)Z_PTR_P(zv); - } else { + } else if (flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE) { key++; zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1); - if (zv && (ZEND_CONSTANT_FLAGS((zend_constant*)Z_PTR_P(zv)) & CONST_CS) == 0) { + if (zv) { c = (zend_constant*)Z_PTR_P(zv); - } else { - if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) { - key++; - zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1); - if (zv) { - c = (zend_constant*)Z_PTR_P(zv); - } else { - key++; - zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1); - if (zv && (ZEND_CONSTANT_FLAGS((zend_constant*)Z_PTR_P(zv)) & CONST_CS) == 0) { - c = (zend_constant*)Z_PTR_P(zv); - } - } - } } } if (!c) { if (!check_defined_only) { - if ((opline->op1.num & IS_CONSTANT_UNQUALIFIED) != 0) { - char *actual = (char *)zend_memrchr(Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)), '\\', Z_STRLEN_P(RT_CONSTANT(opline, opline->op2))); - if (!actual) { - ZVAL_STR_COPY(EX_VAR(opline->result.var), Z_STR_P(RT_CONSTANT(opline, opline->op2))); - } else { - actual++; - ZVAL_STRINGL(EX_VAR(opline->result.var), - actual, Z_STRLEN_P(RT_CONSTANT(opline, opline->op2)) - (actual - Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)))); - } - /* non-qualified constant - allow text substitution */ - zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)", - Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var))); - } else { - zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))); - ZVAL_UNDEF(EX_VAR(opline->result.var)); - } + zend_throw_error(NULL, "Undefined constant '%s'", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2))); + ZVAL_UNDEF(EX_VAR(opline->result.var)); } return FAILURE; } if (!check_defined_only) { ZVAL_COPY_OR_DUP(EX_VAR(opline->result.var), &c->value); - if (!(ZEND_CONSTANT_FLAGS(c) & (CONST_CS|CONST_CT_SUBST))) { - const char *ns_sep; - size_t shortname_offset; - size_t shortname_len; - zend_bool is_deprecated; - - if (flags & IS_CONSTANT_UNQUALIFIED) { - const zval *access_key; - - if (!(flags & IS_CONSTANT_IN_NAMESPACE)) { - access_key = orig_key - 1; - } else { - if (key < orig_key + 2) { - goto check_short_name; - } else { - access_key = orig_key + 2; - } - } - is_deprecated = !zend_string_equals(c->name, Z_STR_P(access_key)); - } else { -check_short_name: - ns_sep = zend_memrchr(ZSTR_VAL(c->name), '\\', ZSTR_LEN(c->name)); - ZEND_ASSERT(ns_sep); - /* Namespaces are always case-insensitive. Only compare shortname. */ - shortname_offset = ns_sep - ZSTR_VAL(c->name) + 1; - shortname_len = ZSTR_LEN(c->name) - shortname_offset; - - is_deprecated = memcmp(ZSTR_VAL(c->name) + shortname_offset, Z_STRVAL_P(orig_key - 1) + shortname_offset, shortname_len) != 0; - } - - if (is_deprecated) { - zend_error(E_DEPRECATED, - "Case-insensitive constants are deprecated. " - "The correct casing for this constant is \"%s\"", - ZSTR_VAL(c->name)); - return SUCCESS; - } - } } CACHE_PTR(opline->extended_value, c); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index e9a4e074e6..5ed80be6ff 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -177,8 +177,6 @@ void init_executor(void) /* {{{ */ EG(ht_iterators) = EG(ht_iterators_slots); memset(EG(ht_iterators), 0, sizeof(EG(ht_iterators_slots))); - EG(each_deprecation_thrown) = 0; - EG(persistent_constants_count) = EG(zend_constants)->nNumUsed; EG(persistent_functions_count) = EG(function_table)->nNumUsed; EG(persistent_classes_count) = EG(class_table)->nNumUsed; @@ -568,29 +566,10 @@ ZEND_API int zend_use_undefined_constant(zend_string *name, zend_ast_attr attr, } else if ((colon = (char*)zend_memrchr(ZSTR_VAL(name), ':', ZSTR_LEN(name)))) { zend_throw_error(NULL, "Undefined class constant '%s'", ZSTR_VAL(name)); return FAILURE; - } else if ((attr & IS_CONSTANT_UNQUALIFIED) == 0) { + } else { zend_throw_error(NULL, "Undefined constant '%s'", ZSTR_VAL(name)); return FAILURE; - } else { - char *actual = ZSTR_VAL(name); - size_t actual_len = ZSTR_LEN(name); - char *slash = (char *) zend_memrchr(actual, '\\', actual_len); - - if (slash) { - actual = slash + 1; - actual_len -= (actual - ZSTR_VAL(name)); - } - - zend_error(E_WARNING, "Use of undefined constant %s - assumed '%s' (this will throw an Error in a future version of PHP)", actual, actual); - if (EG(exception)) { - return FAILURE; - } else { - zend_string *result_str = zend_string_init(actual, actual_len, 0); - zval_ptr_dtor_nogc(result); - ZVAL_NEW_STR(result, result_str); - } } - return SUCCESS; } /* }}} */ @@ -705,20 +684,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) / EG(current_execute_data) = dummy_execute_data.prev_execute_data; } return FAILURE; - } else if (error) { - /* Capitalize the first latter of the error message */ - if (error[0] >= 'a' && error[0] <= 'z') { - error[0] += ('A' - 'a'); - } - zend_error(E_DEPRECATED, "%s", error); - efree(error); - if (UNEXPECTED(EG(exception))) { - if (EG(current_execute_data) == &dummy_execute_data) { - EG(current_execute_data) = dummy_execute_data.prev_execute_data; - } - return FAILURE; - } } + + ZEND_ASSERT(!error); } func = fci_cache->function_handler; @@ -916,16 +884,10 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string * } if (!EG(autoload_func)) { - zend_function *func = zend_fetch_function(ZSTR_KNOWN(ZEND_STR_MAGIC_AUTOLOAD)); - - if (func) { - EG(autoload_func) = func; - } else { - if (!key) { - zend_string_release_ex(lc_name, 0); - } - return NULL; + if (!key) { + zend_string_release_ex(lc_name, 0); } + return NULL; } diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index ee94505fa2..c269d394ac 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -44,7 +44,7 @@ You can use the following macro to check the extension API version for compatibi /* The first number is the engine version and the rest is the date (YYYYMMDD). * This way engine 2/3 API no. is always greater than engine 1 API no.. */ -#define ZEND_EXTENSION_API_NO 320180731 +#define ZEND_EXTENSION_API_NO 420190128 typedef struct _zend_extension_version_info { int zend_extension_api_no; diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 2b15a6578f..5135093636 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -225,8 +225,6 @@ struct _zend_executor_globals { zend_function trampoline; zend_op call_trampoline_op; - zend_bool each_deprecation_thrown; - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; }; diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index efe727207f..6ada3bf4ca 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1287,14 +1287,11 @@ static void zend_do_implement_interfaces(zend_class_entry *ce) /* {{{ */ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe) /* {{{ */ { - if (ZSTR_LEN(ce->name) != ZSTR_LEN(mname) && (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_')) { + if (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_') { /* pass */ } else if (zend_string_equals_literal(mname, ZEND_CLONE_FUNC_NAME)) { ce->clone = fe; } else if (zend_string_equals_literal(mname, ZEND_CONSTRUCTOR_FUNC_NAME)) { - if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { - zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name)); - } ce->constructor = fe; } else if (zend_string_equals_literal(mname, ZEND_DESTRUCTOR_FUNC_NAME)) { ce->destructor = fe; @@ -1318,16 +1315,6 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen ce->__tostring = fe; } else if (zend_string_equals_literal(mname, ZEND_DEBUGINFO_FUNC_NAME)) { ce->__debugInfo = fe; - } else if (ZSTR_LEN(ce->name) == ZSTR_LEN(mname)) { - zend_string *lowercase_name = zend_string_tolower(ce->name); - lowercase_name = zend_new_interned_string(lowercase_name); - if (!memcmp(ZSTR_VAL(mname), ZSTR_VAL(lowercase_name), ZSTR_LEN(mname))) { - if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { - zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name)); - } - ce->constructor = fe; - } - zend_string_release_ex(lowercase_name, 0); } } /* }}} */ @@ -1934,32 +1921,6 @@ static void zend_do_bind_traits(zend_class_entry *ce) /* {{{ */ zend_do_traits_property_binding(ce, traits); efree(traits); - - /* Emit E_DEPRECATED for PHP 4 constructors */ - zend_check_deprecated_constructor(ce); -} -/* }}} */ - - -static zend_bool zend_has_deprecated_constructor(const zend_class_entry *ce) /* {{{ */ -{ - const zend_string *constructor_name; - if (!ce->constructor) { - return 0; - } - constructor_name = ce->constructor->common.function_name; - return !zend_binary_strcasecmp( - ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), - ZSTR_VAL(constructor_name), ZSTR_LEN(constructor_name) - ); -} -/* }}} */ - -void zend_check_deprecated_constructor(const zend_class_entry *ce) /* {{{ */ -{ - if (zend_has_deprecated_constructor(ce)) { - zend_error(E_DEPRECATED, "Methods with the same name as their class will not be constructors in a future version of PHP; %s has a deprecated constructor", ZSTR_VAL(ce->name)); - } } /* }}} */ diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h index bb4b9d6241..9b776afdbd 100644 --- a/Zend/zend_inheritance.h +++ b/Zend/zend_inheritance.h @@ -30,7 +30,6 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent ZEND_API void zend_do_link_class(zend_class_entry *ce, zend_class_entry *parent_ce); void zend_verify_abstract_class(zend_class_entry *ce); -void zend_check_deprecated_constructor(const zend_class_entry *ce); void zend_build_properties_info_table(zend_class_entry *ce); END_EXTERN_C() diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 4b8e30d810..3e34cf4b77 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -31,7 +31,7 @@ #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module -#define ZEND_MODULE_API_NO 20180731 +#define ZEND_MODULE_API_NO 20190128 #ifdef ZTS #define USING_ZTS 1 #else diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 4d8017245e..9704206684 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -415,7 +415,6 @@ EMPTY_SWITCH_DEFAULT_CASE() _(ZEND_STR_THIS, "this") \ _(ZEND_STR_VALUE, "value") \ _(ZEND_STR_KEY, "key") \ - _(ZEND_STR_MAGIC_AUTOLOAD, "__autoload") \ _(ZEND_STR_MAGIC_INVOKE, "__invoke") \ _(ZEND_STR_PREVIOUS, "previous") \ _(ZEND_STR_CODE, "code") \ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 060c4bf6fe..745d4a5a64 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3529,9 +3529,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR, ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -3656,18 +3654,10 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM) SAVE_OPLINE(); function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { + ZEND_ASSERT(!error); func = fcc.function_handler; called_scope = fcc.called_scope; object = fcc.object; - if (error) { - efree(error); - /* This is the only soft error is_callable() can generate */ - zend_non_static_method_call(func); - if (UNEXPECTED(EG(exception) != NULL)) { - FREE_OP2(); - HANDLE_EXCEPTION(); - } - } if (func->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ GC_ADDREF(ZEND_CLOSURE_OBJECT(func)); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index d8258c9783..0ed4d27203 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -5514,9 +5514,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -5556,18 +5554,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS SAVE_OPLINE(); function_name = RT_CONSTANT(opline, opline->op2); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { + ZEND_ASSERT(!error); func = fcc.function_handler; called_scope = fcc.called_scope; object = fcc.object; - if (error) { - efree(error); - /* This is the only soft error is_callable() can generate */ - zend_non_static_method_call(func); - if (UNEXPECTED(EG(exception) != NULL)) { - - HANDLE_EXCEPTION(); - } - } if (func->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ GC_ADDREF(ZEND_CLOSURE_OBJECT(func)); @@ -7797,9 +7787,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -7839,18 +7827,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV SAVE_OPLINE(); function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { + ZEND_ASSERT(!error); func = fcc.function_handler; called_scope = fcc.called_scope; object = fcc.object; - if (error) { - efree(error); - /* This is the only soft error is_callable() can generate */ - zend_non_static_method_call(func); - if (UNEXPECTED(EG(exception) != NULL)) { - zval_ptr_dtor_nogc(free_op2); - HANDLE_EXCEPTION(); - } - } if (func->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ GC_ADDREF(ZEND_CLOSURE_OBJECT(func)); @@ -9483,9 +9463,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -11270,9 +11248,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -11312,18 +11288,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H SAVE_OPLINE(); function_name = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { + ZEND_ASSERT(!error); func = fcc.function_handler; called_scope = fcc.called_scope; object = fcc.object; - if (error) { - efree(error); - /* This is the only soft error is_callable() can generate */ - zend_non_static_method_call(func); - if (UNEXPECTED(EG(exception) != NULL)) { - - HANDLE_EXCEPTION(); - } - } if (func->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ GC_ADDREF(ZEND_CLOSURE_OBJECT(func)); @@ -25895,9 +25863,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -28646,9 +28612,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -30386,9 +30350,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -33118,9 +33080,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -35413,9 +35373,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -37353,9 +37311,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -37885,9 +37841,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -39938,9 +39892,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } |