Add many missing closing PHP tags to tests

Closes GH-5958
This commit is contained in:
Máté Kocsis 2020-08-09 11:06:57 +02:00
parent 05478e985e
commit 7aacc705d0
No known key found for this signature in database
GPG key ID: FD055E41728BF310
1103 changed files with 1097 additions and 30 deletions

View file

@ -19,6 +19,7 @@ class Ext extends Base
$a = new Ext();
$a->someMethod("foo");
$a->someMethod();
?>
--EXPECT--
foo
default

View file

@ -3,6 +3,7 @@ declare bare anonymous class
--FILE--
<?php
var_dump(new class{});
?>
--EXPECTF--
object(class@%s)#%d (0) {
}

View file

@ -15,6 +15,7 @@ $a = new class extends A implements B {
};
var_dump($a instanceof A, $a instanceof B);
?>
--EXPECT--
bool(true)
bool(true)

View file

@ -10,6 +10,7 @@ while (@$i++<10) {
}
});
}
?>
--EXPECTF--
object(class@%s)#1 (1) {
["i"]=>

View file

@ -26,5 +26,6 @@ $outer = new Outer(array(
/* not null because inheritance */
var_dump($outer->getArrayAccess()[0]);
?>
--EXPECTF--
int(%d)

View file

@ -32,5 +32,6 @@ $proxy = $outer->getArrayAccess();
/* null because no inheritance, so no access to protected member */
var_dump(@$outer->getArrayAccess()[0]);
?>
--EXPECT--
NULL

View file

@ -9,6 +9,7 @@ namespace lone {
namespace {
var_dump ($hello);
}
?>
--EXPECTF--
object(class@%s)#1 (0) {
}

View file

@ -17,6 +17,7 @@ namespace lone {
new Outer();
}
?>
--EXPECTF--
object(class@%s)#2 (0) {
}

View file

@ -18,6 +18,7 @@ $anonClass = new class("cats", "dogs") {
var_dump($anonClass::$foo);
var_dump($anonClass::getBar());
?>
--EXPECT--
string(4) "cats"
string(4) "dogs"

View file

@ -14,5 +14,6 @@ $anonClass = new class {
};
var_dump($anonClass->someMethod());
?>
--EXPECT--
string(3) "bar"

View file

@ -24,6 +24,7 @@ var_dump([...new ArrayIterator(['a', 'b', 'c'])]);
var_dump([0, ...$array, ...getArr(), 6, 7, 8, 9, 10, ...arrGen()]);
var_dump([0, ...$array, ...$array, 'end']);
?>
--EXPECT--
array(0) {
}

View file

@ -22,6 +22,7 @@ try {
} catch (Error $ex) {
echo "Exception: " . $ex->getMessage() . "\n";
}
?>
--EXPECT--
array(5) {
[0]=>

View file

@ -13,5 +13,6 @@ try {
echo "Exception: " . $ex->getMessage() . "\n";
}
?>
--EXPECT--
Exception: Cannot unpack Traversable with non-integer keys

View file

@ -10,6 +10,7 @@ unset($a); //array (0 => (refcount=1, is_ref=1)=1)
var_dump([...$b]); //array (0 => (refcount=0, is_ref=0)=1)
?>
--EXPECT--
array(1) {
[0]=>

View file

@ -16,6 +16,7 @@ try {
var_dump($ex->getMessage());
}
?>
--EXPECT--
string(36) "Cannot unpack array with string keys"
string(42) "Cannot unpack Traversable with string keys"

View file

@ -5,6 +5,7 @@ array unpacking with undefinded variable
var_dump([...$arr]);
?>
--EXPECTF--
Warning: Undefined variable $arr in %s on line %d

View file

@ -8,5 +8,6 @@ assert.exception=0
assert_options(ASSERT_WARNING);
assert(false && ($a **= 2));
?>
--EXPECTF--
Warning: assert(): assert(false && ($a **= 2)) failed in %s%ezend-pow-assign.php on line %d

View file

@ -8,5 +8,6 @@ assert.exception=0
assert_options(ASSERT_WARNING);
assert(false && `echo -n ""`);
?>
--EXPECTF--
Warning: assert(): assert(false && `echo -n ""`) failed in %s%east_serialize_backtick_literal.php on line %d

View file

@ -14,6 +14,7 @@ foreach ($attributes as $attribute) {
var_dump(get_class($a));
var_dump($a->flags == Attribute::TARGET_ALL);
}
?>
--EXPECT--
string(9) "Attribute"
array(0) {

View file

@ -5,5 +5,6 @@ Attributes: Prevent Attribute on non classes
@@Attribute
function foo() {}
?>
--EXPECTF--
Fatal error: Attribute "Attribute" cannot target function (allowed targets: class) in %s

View file

@ -11,5 +11,6 @@ if (!extension_loaded('zend-test')) {
@@ZendTestAttribute
function foo() {
}
?>
--EXPECTF--
Fatal error: Only classes can be marked with @@ZendTestAttribute in %s

View file

@ -77,6 +77,7 @@ var_dump(-0b11111111111111111111111111111111);
var_dump(-0b1111111111111111111111111111111);
var_dump(-0b111111111111111111111111111111);
var_dump(-0b1);
?>
--EXPECT--
int(1)
int(3)

View file

@ -79,6 +79,7 @@ var_dump(-0b1111111111111111111111111111111111111111111111111111111111111111);
var_dump(-0b111111111111111111111111111111111111111111111111111111111111111);
var_dump(-0b11111111111111111111111111111111111111111111111111111111111111);
var_dump(-0b1);
?>
--EXPECT--
int(1)
int(3)

View file

@ -13,6 +13,7 @@ try {
} catch (Exception $e) {
var_dump($x);
}
?>
--EXPECT--
object(foo)#1 (0) {
}

View file

@ -13,5 +13,6 @@ try {
} catch (Error $e) {
echo 'OK';
}
?>
--EXPECT--
OK

View file

@ -24,6 +24,7 @@ foreach($a as $k => $d)
}
// Alternatively $c = $a; and foreachloop removal will cause identical results.
var_dump(key($a['b']));
?>
--EXPECT--
int(3)
int(3)

View file

@ -35,6 +35,7 @@ $a = new A();
$b = new B();
$c = new C();
$d = new D();
?>
--EXPECT--
A::foo
A::foo

View file

@ -19,6 +19,7 @@ foreach ($arr["v"] as $k => $v) {
var_dump($k);
}
var_dump(key($arr["v"]));
?>
--EXPECT--
int(0)
int(0)

View file

@ -17,6 +17,7 @@ foreach ($foo as $k => $v) {
var_dump($k);
}
var_dump(key($foo));
?>
--EXPECT--
int(0)
int(0)

View file

@ -5,6 +5,7 @@ Bug #41401 (wrong precedence for unary minus)
echo 1/-2*5;
echo "\n";
echo 6/+2*-3;
?>
--EXPECT--
-2.5
-9

View file

@ -8,6 +8,7 @@ class foo {
}
var_dump(get_class_vars("foo"));
?>
--EXPECT--
array(1) {
["x"]=>

View file

@ -20,6 +20,7 @@ $a = new A();
$a->foo();
$b = new B();
$b->foo();
?>
--EXPECT--
bool(true)
bool(true)

View file

@ -11,5 +11,6 @@ function foo($c = ok::constant) {
}
foo();
?>
--EXPECT--
ok

View file

@ -31,6 +31,7 @@ test2($x);
test3($x);
test4($y);
test5($x);
?>
--EXPECTF--
ok
ok

View file

@ -17,6 +17,7 @@ var_dump(defined('\\ns\\foo::ok'));
var_dump(defined('\\ns\\foo::bug'));
var_dump(defined('ns\\bar::bug'));
var_dump(defined('\\ns\\bar::bug'));
?>
--EXPECT--
bool(true)
bool(false)

View file

@ -8,5 +8,6 @@ class Foo {}
class Bar {}
use Test\Bar;
echo "ok\n";
?>
--EXPECT--
ok

View file

@ -11,6 +11,7 @@ class foo {
$foo = new foo;
$foo->bar($foo); // Ok!
$foo->bar(new \stdclass); // Error, ok!
?>
--EXPECTF--
Fatal error: Uncaught TypeError: foobar\foo::bar(): Argument #1 ($a) must be of type foobar\foo, stdClass given, called in %s:%d
Stack trace:

View file

@ -11,5 +11,6 @@ class foo {
$foo = new foo;
$foo->bar($foo); // Ok!
$foo->bar(new stdclass); // Error, ok!
?>
--EXPECTF--
Fatal error: '\self' is an invalid class name in %sbug43332_2.php on line 5

View file

@ -22,6 +22,7 @@ var_dump(is_callable("Test::foo"));
var_dump(is_callable("\\Test::foo"));
var_dump(is_callable("is_string"));
var_dump(is_callable("\\is_string"));
?>
--EXPECT--
bool(false)
bool(false)

View file

@ -21,6 +21,7 @@ class Y extends X
$y = Y::cheat(5);
echo $y->x, PHP_EOL;
?>
--EXPECTF--
Fatal error: Uncaught Error: Call to private X::__construct() from scope Y in %s:%d
Stack trace:

View file

@ -33,6 +33,7 @@ class Bar2 extends Foo2 {
}
new Bar2(array());
?>
--EXPECT--
array(0) {
}

View file

@ -6,6 +6,7 @@ $a = "string";
$b = &$a[1];
$b = "f";
echo $a;
?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot create references to/from string offsets in %sbug49866.php:3
Stack trace:

View file

@ -17,6 +17,7 @@ $proxy = new Proxy;
call_user_func_array( array( $proxy, 'bar' ), $args );
call_user_func_array( array( $proxy, 'bar' ), array(&$arg) );
var_dump($arg);
?>
--EXPECT--
bar called!
bar called!

View file

@ -35,6 +35,7 @@ var_dump($mapWithoutConst0[1]);
var_dump($mapWithoutConst1[1]);
var_dump($mapWithoutConst2[1]);
var_dump($mapWithoutConst3[1]);
?>
--EXPECT--
string(3) "two"
string(3) "two"

View file

@ -12,6 +12,7 @@ function eh()
set_error_handler("eh");
$a = $empty($b);
?>
--EXPECTF--
Fatal error: Uncaught Exception: error! in %sbug51394.php:%d
Stack trace:

View file

@ -69,6 +69,7 @@ $foo->f1()[0]++;
var_dump($foo->a1[0]);
$foo->f6()[0]++;
var_dump($foo->a1[0]);
?>
--EXPECT--
NULL
array(0) {

View file

@ -12,5 +12,6 @@ $myGlobal=new MyClass();
$myGlobal->myRef=&$myGlobal;
$myGlobal->myNonExistentProperty="ok\n";
echo $myGlobal;
?>
--EXPECT--
ok

View file

@ -19,6 +19,7 @@ function test() {
test();
echo "bug\n";
?>
--EXPECTF--
Fatal error: Uncaught Exception: ops 1 in %sbug53511.php:4
Stack trace:

View file

@ -15,6 +15,7 @@ echo (defined('ChildClass::TEST_CONSTANT') ? 'true' : 'false') . "\n";
echo (is_subclass_of('ParentClass', 'MyInterface') ? 'true' : 'false') . "\n";
echo (defined('ParentClass::TEST_CONSTANT') ? 'true' : 'false') . "\n";
?>
--EXPECT--
true
true

View file

@ -41,6 +41,7 @@ function test_3() {
}
$f = test_3(); $f();
$f = test_3(); $f();
?>
--EXPECT--
Outer function increments $v to 1
Inner function reckons $v is 1

View file

@ -31,5 +31,6 @@ class Test
}
$x = new Test();
Test::$mystatic = new DestructorCreator();
?>
--EXPECTF--
Fatal error: Allowed memory size of %s bytes exhausted%s(tried to allocate %s bytes) in %s on line %d

View file

@ -13,6 +13,7 @@ var_dump("0x7fffffffffffffff" == "9223372036854775808");
/* not exactly what the bug is about, but closely related problem: */
var_dump("999223372036854775807"=="999223372036854775808");
var_dump("899223372036854775807">"00999223372036854775807");
?>
--EXPECT--
bool(false)
bool(false)

View file

@ -24,5 +24,6 @@ class B extends A {}
$input = new B();
echo $input->getEmail();
?>
--EXPECT--
No such method - 'noSuchMethod'

View file

@ -24,6 +24,7 @@ $test->{'method'}();
Test::method();
Test::$method();
Test::{'method'}();
?>
--EXPECT--
method
method

View file

@ -12,6 +12,7 @@ class C { use T1; }
$c1 = new C;
$c1->inc();
$c1->inc();
?>
--EXPECT--
1
2

View file

@ -7,5 +7,6 @@ $arr = array("test");
list($a,$b) = is_array($arr)? $arr : $arr;
list($c,$d) = is_array($arr)?: NULL;
echo "ok\n";
?>
--EXPECT--
ok

View file

@ -59,6 +59,7 @@ if (empty($arr['exists'][1][0])) {
var_dump($arr['exists'][1][0]);
}
echo "DONE";
?>
--EXPECT--
sub-key 'non_existent' is not set.
sub-key 1 is set: string(1) "o"

View file

@ -14,5 +14,6 @@ class Some {
}
new Foo;
echo "done\n";
?>
--EXPECT--
done

View file

@ -14,5 +14,6 @@ $cls->{true}();
$cls->{false}();
$cls->{null}();
echo "ok\n";
?>
--EXPECTF--
Fatal error: Method name must be a string in %sbug60613.php on line %d

View file

@ -9,6 +9,7 @@ set_error_handler(function($errno, $errstr, $errfile, $errline){
});
require 'notfound.php';
?>
--EXPECTF--
error(require(notfound.php): Failed to open stream: %s)
Fatal error: Uncaught Exception: Foo in %sbug60909_1.php:5

View file

@ -12,6 +12,7 @@ class Bad {
$bad = new Bad();
echo "$bad";
?>
--EXPECTF--
Fatal error: Uncaught Exception: I CAN DO THIS in %s:%d
Stack trace:

View file

@ -21,6 +21,7 @@ for ($i = 0; $i < 3; $i++) {
strip_tags(new T);
}
var_dump($handler);
?>
--EXPECTF--
object(T)#%d (1) {
["_this"]=>

View file

@ -10,6 +10,7 @@ Bug #61273 (call_user_func_array with more than 16333 arguments leaks / crashes)
$args = array_fill(0, 64 * 1024 - 64, 0);
call_user_func_array(function(&$a) {}, $args);
echo strval("okey");
?>
--EXPECTF--
Warning: {closure}(): Argument #1 ($a) must be passed by reference, value given in %s on line %d
okey

View file

@ -14,6 +14,7 @@ register_shutdown_function(function(){
//$undefined = null; // defined variable does not cause problems
$undefined->foo();
?>
--EXPECTF--
Error handler called (Undefined variable $undefined)

View file

@ -23,6 +23,7 @@ Bug #61782 (__clone/__destruct do not match other methods when checking access c
$obj = new LatchkeyKid();
echo "DONE\n";
?>
--EXPECT--
In LatchkeyKid:
MommasBoy::__clone

View file

@ -12,5 +12,6 @@ class Bar extends Foo {
}
echo 'DONE';
?>
--EXPECT--
DONE

View file

@ -10,5 +10,6 @@ abstract class Foo {
class Bar extends Foo {
protected function __construct(){}
}
?>
--EXPECTF--
Fatal error: Access level to Bar::__construct() must be public (as in class Foo) in %s on line 8

View file

@ -14,5 +14,6 @@ class Bar extends Foo {
class Baz extends Bar {
protected function __construct(){}
}
?>
--EXPECTF--
Fatal error: Access level to Baz::__construct() must be public (as in class Foo) in %s on line 12

View file

@ -10,6 +10,7 @@ var_dump("02147483647" == "2147483647",
"02147483648" == "2147483648",
"09007199254740991" == "9007199254740991",
"09007199254740992" == "9007199254740992");
?>
--EXPECT--
bool(true)
bool(true)

View file

@ -25,5 +25,6 @@ class Bar extends Foo
$x = new Bar;
var_dump($x->run());
?>
--EXPECT--
string(3) "Bar"

View file

@ -34,6 +34,7 @@ for ($n = 0; $n < 20; $n++) {
echo "$n\n";
}
echo "ok\n";
?>
--EXPECT--
0
1

View file

@ -10,6 +10,7 @@ $test = new Test();
var_dump(isset($test->protectedProperty));
var_dump(isset($test->protectedProperty->foo));
?>
--EXPECT--
bool(false)
bool(false)

View file

@ -13,5 +13,6 @@ try {
} catch(Throwable $e) {
echo "Exception is thrown";
}
?>
--EXPECT--
Exception is thrown

View file

@ -15,6 +15,7 @@ trait T2 {
}
print_r(get_class_methods("A"));
print_r(get_class_methods("B"));
?>
--EXPECT--
Array
(

View file

@ -34,5 +34,6 @@ $o = new obj;
$o['x'] = 1;
++$o['x'];
echo $o['x'], "\n";
?>
--EXPECT--
2

View file

@ -9,6 +9,7 @@ function x($s) { $s['2a'] = 1; };
$y = '1';
x($y);
print_r($y);
?>
--EXPECT--
string(26) "Illegal string offset "2a""
1

View file

@ -22,6 +22,7 @@ Class E {
}
$isCallable = is_callable(array('E', 'f'));
var_dump($isCallable);
?>
--EXPECT--
bool(false)
bool(false)

View file

@ -16,5 +16,6 @@ catch (Exception $e)
{
echo 'caught';
}
?>
--EXPECT--
caught

View file

@ -53,6 +53,7 @@ function foo3() {
}
$bar = foo3();
?>
--EXPECTF--
string(9) "not catch"
NULL

View file

@ -23,7 +23,6 @@ class Test
$test = new Test();
?>
--EXPECT--
array (
1 => 'first',

View file

@ -10,5 +10,6 @@ class B extends A {
}
const C = B::BHW;
echo C, "\n";
?>
--EXPECT--
this is A extended by B

View file

@ -57,6 +57,7 @@ function bar() {
echo "13\n";
}
bar();
?>
--EXPECT--
1
2

View file

@ -14,6 +14,7 @@ crash();
echo "made it once\n";
crash();
echo "ok\n";
?>
--EXPECTF--
Warning: Undefined variable $i in %s on line %d
made it once

View file

@ -8,5 +8,6 @@ class FooBar {
const bar = ["bar" => 3]["bar"];
}
echo "okey";
?>
--EXPECT--
okey

View file

@ -21,6 +21,7 @@ a::staticTest();
$b = new b();
$b->test();
?>
--EXPECTF--
string(%d) "The magic method b::__invoke() must have public visibility"
b::test()

View file

@ -13,6 +13,7 @@ a::staticTest();
$b = new b();
$b->test();
?>
--EXPECTF--
Warning: The magic method b::__invoke() must have public visibility in %s on line %d
b::test()

View file

@ -12,5 +12,6 @@ $c = new C();
$x = $c->test();
print_r($x);
unset($c, $x);
?>
--EXPECTF--
Fatal error: Cannot unset $this in %sbug68370.php on line 4

View file

@ -26,6 +26,7 @@ $obj = new A;
$obj["a"] = 1;
$obj["a"] .= "test";
var_dump($obj["a"]);
?>
--EXPECT--
string(5) "1test"
string(5) "1test"

View file

@ -21,6 +21,7 @@ $foo->bad->x = new stdClass;
unset($foo);
gc_collect_cycles();
var_dump($bar);
?>
--EXPECT--
object(bad)#2 (2) {
["x"]=>

View file

@ -30,6 +30,7 @@ unserialize(serialize($foo));
gc_collect_cycles();
var_dump($bar);
?>
--EXPECT--
object(bad)#4 (1) {
["_private"]=>

View file

@ -19,6 +19,7 @@ $wpq = new wpq;
$wpq->interesting =& ret_assoc();
$x = $wpq->interesting;
printf("%s\n", $x);
?>
--EXPECTF--
Warning: Undefined property: wpq::$interesting in %s on line %d

View file

@ -6,6 +6,7 @@ Bug #69891: Unexpected array comparison result
var_dump([1, 2, 3] <=> []);
var_dump([] <=> [1, 2, 3]);
var_dump([1] <=> [2, 3]);
?>
--EXPECT--
int(1)
int(-1)

View file

@ -25,6 +25,7 @@ class C10 implements ArrayAccess
$c10 = new C10;
var_dump($c10[] += 5);
?>
--EXPECT--
Inside C10::offsetGet
NULL

View file

@ -16,6 +16,7 @@ function &foo1() :string {
var_dump(foo());
var_dump(foo1());
?>
--EXPECT--
string(1) "1"
string(3) "ref"

View file

@ -35,5 +35,6 @@ unset($t);
unset($a);
var_dump(gc_collect_cycles());
?>
--EXPECT--
int(2)

View file

@ -22,5 +22,6 @@ class B extends A {
$b = new B;
$b->test();
?>
--EXPECT--
bool(true)

View file

@ -3,6 +3,7 @@ Bug #71221 (Null pointer deref (segfault) in get_defined_vars via ob_start)
--FILE--
<?php
register_shutdown_function("get_defined_vars");
?>
--EXPECT--
Fatal error: Uncaught Error: Cannot call get_defined_vars() dynamically in [no active file]:0
Stack trace:

View file

@ -21,5 +21,6 @@ class Y extends X implements InterfaceY {
}
echo "ok";
?>
--EXPECT--
ok

View file

@ -8,5 +8,6 @@ class A {
class B extends A {
public function m(array $a = []) {}
}
?>
--EXPECTF--
Fatal error: Declaration of B::m(array $a = []) must be compatible with A::m(?array $a = null) in %s on line %d

View file

@ -73,6 +73,7 @@ $OuterMatcher->methodNameMatcher = null;
$OuterMatcher->stub = new PHPUnit_Framework_MockObject_Stub_ReturnCallback([$foo, 'callback']);
$a = $b = $c = 0;
$foo->bar($a, $b, $c);
?>
--EXPECTF--
Fatal error: Uncaught Error: Class "DoesNotExists" not found in %s:%d
Stack trace:

Some files were not shown because too many files have changed in this diff Show more