: tests/classes/abstract_by_interface_001.phpt
--TEST-- ZE2 An abstract method may not be called --FILE-- <?php class Root { } interface MyInterface { function MyInterfaceFunc(); } abstract class Derived extends Root implements MyInterface { } class Leaf extends Derived { function MyInterfaceFunc() {} } var_dump(new Leaf); class Fails extends Root implements MyInterface { } ?> ===DONE=== --EXPECTF-- object(Leaf)#%d (0) { } Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_001.php on line %d
: tests/classes/abstract_by_interface_002.phpt
interface MyInterface { static function MyInterfaceFunc(); } .... class Fails extends Root implements MyInterface { } ?> ===DONE=== --EXPECTF-- object(Leaf)#%d (0) { } Fatal error: Class Fails contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (MyInterface::MyInterfaceFunc) in %sabstract_by_interface_002.php on line %d
: tests/classes/abstract_derived.phpt
--TEST-- ZE2 A derived class with an abstract method must be abstract --SKIPIF-- <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> --FILE-- <?php class base { } class derived extends base { abstract function show(); } ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- Fatal error: Class derived contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (derived::show) in %sabstract_derived.php on line %d
: tests/classes/abstract_redeclare.phpt
<?php class pass { function show() { echo "Call to function show()\n"; } } class fail extends pass { abstract function show(); } echo "Done\n"; // Shouldn't be displayed ?>
: tests/func/002.phpt
--TEST-- Static variables in functions --FILE-- <?php function blah() { static $hey=0,$yo=0; echo "hey=".$hey++.", ",$yo--."\n"; } blah(); blah(); blah(); if (isset($hey) || isset($yo)) { echo "Local variables became global :(\n"; } --EXPECT-- hey=0, 0 hey=1, -1 hey=2, -2
--TEST-- Bug #28800 (Incorrect string to number conversion for strings starting with 'inf') --FILE-- <?php $strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable'); foreach ($strings as $v) { echo ($v+0)."\n"; } ?> --EXPECT--
Source: https://habr.com/ru/post/303116/
All Articles