Reindent phpt files

This commit is contained in:
Nikita Popov 2020-02-03 22:52:20 +01:00
parent d2cb200e10
commit f8d795820e
5414 changed files with 75041 additions and 75041 deletions

View file

@ -4,39 +4,39 @@ func_num_args() tests
<?php
function test1() {
var_dump(func_num_args());
var_dump(func_num_args());
}
function test2($a) {
var_dump(func_num_args());
var_dump(func_num_args());
}
function test3($a, $b) {
var_dump(func_num_args());
var_dump(func_num_args());
}
test1();
test2(1);
try {
test2();
test2();
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
echo "Exception: " . $e->getMessage() . "\n";
}
test3(1,2);
call_user_func("test1");
try {
call_user_func("test3", 1);
call_user_func("test3", 1);
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
echo "Exception: " . $e->getMessage() . "\n";
}
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_num_args());
}
static function test1($a) {
var_dump(func_num_args());
}
}
test::test1(1);

View file

@ -4,45 +4,45 @@ func_get_arg() tests
<?php
function test1() {
var_dump(func_get_arg(-10));
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
var_dump(func_get_arg(-10));
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
function test2($a) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
function test3($a, $b) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
var_dump(func_get_arg(2));
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
var_dump(func_get_arg(2));
}
test1();
test1(10);
test2(1);
try {
test2();
test2();
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
echo "Exception: " . $e->getMessage() . "\n";
}
test3(1,2);
call_user_func("test1");
try {
call_user_func("test3", 1);
call_user_func("test3", 1);
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
echo "Exception: " . $e->getMessage() . "\n";
}
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
static function test1($a) {
var_dump(func_get_arg(0));
var_dump(func_get_arg(1));
}
}
test::test1(1);

View file

@ -4,39 +4,39 @@ func_get_args() tests
<?php
function test1() {
var_dump(func_get_args());
var_dump(func_get_args());
}
function test2($a) {
var_dump(func_get_args());
var_dump(func_get_args());
}
function test3($a, $b) {
var_dump(func_get_args());
var_dump(func_get_args());
}
test1();
test1(10);
test2(1);
try {
test2();
test2();
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
echo "Exception: " . $e->getMessage() . "\n";
}
test3(1,2);
call_user_func("test1");
try {
call_user_func("test3", 1);
call_user_func("test3", 1);
} catch (Throwable $e) {
echo "Exception: " . $e->getMessage() . "\n";
echo "Exception: " . $e->getMessage() . "\n";
}
call_user_func("test3", 1, 2);
class test {
static function test1($a) {
var_dump(func_get_args());
}
static function test1($a) {
var_dump(func_get_args());
}
}
test::test1(1);

View file

@ -4,9 +4,9 @@ get_class() tests
<?php
class foo {
function bar () {
var_dump(get_class());
}
function bar () {
var_dump(get_class());
}
function testNull ()
{
try {

View file

@ -4,19 +4,19 @@ get_parent_class() tests
<?php
interface i {
function test();
function test();
}
class foo implements i {
function test() {
var_dump(get_parent_class());
}
function test() {
var_dump(get_parent_class());
}
}
class bar extends foo {
function test_bar() {
var_dump(get_parent_class());
}
function test_bar() {
var_dump(get_parent_class());
}
}
$bar = new bar;

View file

@ -4,23 +4,23 @@ property_exists() tests
<?php
class foo {
public $pp1 = 1;
private $pp2 = 2;
protected $pp3 = 3;
public $pp1 = 1;
private $pp2 = 2;
protected $pp3 = 3;
function bar() {
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
}
function bar() {
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
}
}
class bar extends foo {
function test() {
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
}
function test() {
var_dump(property_exists("foo","pp1"));
var_dump(property_exists("foo","pp2"));
var_dump(property_exists("foo","pp3"));
}
}
var_dump(property_exists("foo","pp1"));

View file

@ -6,11 +6,11 @@ func_get_arg() invalid usage
var_dump(func_get_arg(1));
function bar() {
var_dump(func_get_arg(1));
var_dump(func_get_arg(1));
}
function foo() {
bar(func_get_arg(1));
bar(func_get_arg(1));
}
foo(1,2);

View file

@ -5,15 +5,15 @@ Implementing abstracting methods and optional parameters
abstract class Base
{
abstract function someMethod($param);
abstract function someMethod($param);
}
class Ext extends Base
{
function someMethod($param = "default")
{
echo $param, "\n";
}
function someMethod($param = "default")
{
echo $param, "\n";
}
}
$a = new Ext();

View file

@ -10,20 +10,20 @@ print "\n";
class bar {
public function a() {
return "bar!";
}
public function a() {
return "bar!";
}
}
class foo {
public function test() {
print "foo!\n";
return new bar;
}
public function test() {
print "foo!\n";
return new bar;
}
}
function test() {
return new foo;
return new foo;
}
$a = 'test';

View file

@ -4,9 +4,9 @@ Testing dynamic calls
<?php
class foo {
static public function a() {
print "ok\n";
}
static public function a() {
print "ok\n";
}
}
$a = 'a';

View file

@ -4,8 +4,8 @@ Trying assign value to property when an object is not returned in a function
<?php
class foo {
public function a() {
}
public function a() {
}
}
$test = new foo;

View file

@ -4,26 +4,26 @@ Overriding $this in catch and checking the object properties later.
<?php
class foo {
public $test = 0;
private $test_2 = 1;
protected $test_3 = 2;
public $test = 0;
private $test_2 = 1;
protected $test_3 = 2;
public function bar() {
try {
throw new Exception('foo');
} catch (Exception $this) {
var_dump($this);
}
public function bar() {
try {
throw new Exception('foo');
} catch (Exception $this) {
var_dump($this);
}
$this->baz();
}
$this->baz();
}
public function baz() {
foreach ($this as $k => $v) {
printf("'%s' => '%s'\n", $k, $v);
}
print "ok\n";
}
public function baz() {
foreach ($this as $k => $v) {
printf("'%s' => '%s'\n", $k, $v);
}
print "ok\n";
}
}
$test = new foo;

View file

@ -4,21 +4,21 @@ Testing multiples 'default:' in switch
<?php
switch (1) {
case 2:
print 'foo';
break;
case 3:
print 'bar';
break;
default:
print 1;
break;
default:
print 2;
break;
default:
print 3;
break;
case 2:
print 'foo';
break;
case 3:
print 'bar';
break;
default:
print 1;
break;
default:
print 2;
break;
default:
print 3;
break;
}
?>

View file

@ -4,8 +4,8 @@ using multiple access modifiers (methods)
<?php
class test {
static public public static final public final function foo() {
}
static public public static final public final function foo() {
}
}
echo "Done\n";

View file

@ -4,7 +4,7 @@ using multiple access modifiers (attributes)
<?php
class test {
static public public static final public final $var;
static public public static final public final $var;
}
echo "Done\n";

View file

@ -4,7 +4,7 @@ using multiple access modifiers (classes)
<?php
final final class test {
function foo() {}
function foo() {}
}
echo "Done\n";

View file

@ -4,8 +4,8 @@ using multiple access modifiers (abstract methods)
<?php
class test {
abstract abstract function foo() {
}
abstract abstract function foo() {
}
}
echo "Done\n";

View file

@ -4,8 +4,8 @@ using multiple access modifiers (final methods)
<?php
class test {
final final function foo() {
}
final final function foo() {
}
}
echo "Done\n";

View file

@ -4,8 +4,8 @@ using multiple access modifiers (static methods)
<?php
class test {
static static function foo() {
}
static static function foo() {
}
}
echo "Done\n";

View file

@ -4,7 +4,7 @@ abstract final methods errmsg
<?php
class test {
final abstract function foo();
final abstract function foo();
}
echo "Done\n";

View file

@ -6,13 +6,13 @@ Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
<?php
class A {
static protected function f() {return 'A::f()';}
static protected function f() {return 'A::f()';}
}
class B1 extends A {
static protected function f() {return 'B1::f()';}
static protected function f() {return 'B1::f()';}
}
class B2 extends A {
static public function test() {echo B1::f();}
static public function test() {echo B1::f();}
}
B2::test();

View file

@ -6,16 +6,16 @@ Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
<?php
class A {
static protected function f() {return 'A::f()';}
static protected function f() {return 'A::f()';}
}
class B1 extends A {
static protected function f() {return 'B1::f()';}
static protected function f() {return 'B1::f()';}
}
class B2 extends A {
static public function test() {
var_dump(is_callable('B1::f'));
B1::f();
}
static public function test() {
var_dump(is_callable('B1::f'));
B1::f();
}
}
B2::test();

View file

@ -4,24 +4,24 @@ Testing visibility of methods
<?php
class d {
private function test2() {
print "Bar\n";
}
private function test2() {
print "Bar\n";
}
}
abstract class a extends d {
public function test() {
$this->test2();
}
public function test() {
$this->test2();
}
}
abstract class b extends a {
}
class c extends b {
public function __construct() {
$this->test();
}
public function __construct() {
$this->test();
}
}
new c;

View file

@ -4,25 +4,25 @@ __call() for private/protected methods
<?php
class A {
private $var1 = 'var1 value';
protected $var2 = 'var2 value';
private $var1 = 'var1 value';
protected $var2 = 'var2 value';
private function func1()
{
return "in func1";
}
protected function func2()
{
return "in func2";
}
public function __get($var)
{
return $this->$var;
}
public function __call($func, array $args = array())
{
return call_user_func_array(array($this, $func), $args);
}
private function func1()
{
return "in func1";
}
protected function func2()
{
return "in func2";
}
public function __get($var)
{
return $this->$var;
}
public function __call($func, array $args = array())
{
return call_user_func_array(array($this, $func), $args);
}
}
$a = new A();

View file

@ -3,9 +3,9 @@ Trigger __call() in lieu of non visible methods when called via a callback.
--FILE--
<?php
class C {
protected function prot() { }
private function priv() { }
public function __call($name, $args) {
protected function prot() { }
private function priv() { }
public function __call($name, $args) {
echo "In __call() for method $name()\n";
}
}

View file

@ -4,7 +4,7 @@ Prevent abstract and final in the same class declaration
<?php
final abstract class C {
private function priv() { }
private function priv() { }
}
?>

View file

@ -9,9 +9,9 @@ $o = new stdclass;
$o->prop = "value";
try {
var_dump($a + $o);
var_dump($a + $o);
} catch (Error $e) {
echo "\nException: " . $e->getMessage() . "\n";
echo "\nException: " . $e->getMessage() . "\n";
}
$c = $a + $o;

View file

@ -9,9 +9,9 @@ $o = new stdclass;
$o->prop = "value";
try {
var_dump($o + $a);
var_dump($o + $a);
} catch (Error $e) {
echo "\nException: " . $e->getMessage() . "\n";
echo "\nException: " . $e->getMessage() . "\n";
}
$c = $o + $a;

View file

@ -6,9 +6,9 @@ adding numbers to arrays
$a = array(1,2,3);
try {
var_dump($a + 5);
var_dump($a + 5);
} catch (Error $e) {
echo "\nException: " . $e->getMessage() . "\n";
echo "\nException: " . $e->getMessage() . "\n";
}
$c = $a + 5;

View file

@ -8,9 +8,9 @@ $a = array(1,2,3);
$s1 = "some string";
try {
var_dump($a + $s1);
var_dump($a + $s1);
} catch (Error $e) {
echo "\nException: " . $e->getMessage() . "\n";
echo "\nException: " . $e->getMessage() . "\n";
}
$c = $a + $s1;

View file

@ -5,9 +5,9 @@ Ensure proper inheritance with get_class(anon class instance) used via class_ali
class_alias(get_class(new class { protected $foo = 1; }), "AnonBase");
var_dump((new class extends AnonBase {
function getFoo() {
return $this->foo;
}
function getFoo() {
return $this->foo;
}
})->getFoo());
?>
--EXPECT--

View file

@ -3,17 +3,17 @@ Argument unpacking does not work with non-integer keys
--FILE--
<?php
function foo(...$args) {
var_dump($args);
var_dump($args);
}
function gen() {
yield 1.23 => 123;
yield "2.34" => 234;
yield 1.23 => 123;
yield "2.34" => 234;
}
try {
foo(...gen());
foo(...gen());
} catch (Error $ex) {
echo "Exception: " . $ex->getMessage() . "\n";
echo "Exception: " . $ex->getMessage() . "\n";
}
?>

View file

@ -8,14 +8,14 @@ set_error_handler(function($errno, $errstr) {
});
try {
var_dump(...[1, 2, "foo" => 3, 4]);
var_dump(...[1, 2, "foo" => 3, 4]);
} catch (Error $ex) {
var_dump($ex->getMessage());
var_dump($ex->getMessage());
}
try {
var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
} catch (Error $ex) {
var_dump($ex->getMessage());
var_dump($ex->getMessage());
}
?>

View file

@ -3,13 +3,13 @@ Bug #55719 (Argument restriction should come with a more specific error message)
--FILE--
<?php
Class Base {
public function &test($foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
}
public function &test($foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
}
}
class Sub extends Base {
public function &test() {
}
public function &test() {
}
}
?>
--EXPECTF--

View file

@ -3,13 +3,13 @@ Bug #55719 (Argument restriction should come with a more specific error message)
--FILE--
<?php
Abstract Class Base {
public function test($foo, array &$bar, $option = NULL, $extra = 3.141592653589793238462643383279502884197169399375105 ) {
}
public function test($foo, array &$bar, $option = NULL, $extra = 3.141592653589793238462643383279502884197169399375105 ) {
}
}
class Sub extends Base {
public function test($foo, array &$bar) {
}
public function test($foo, array &$bar) {
}
}
?>
--EXPECTF--

View file

@ -6,13 +6,13 @@ class Foo {
}
Abstract Class Base {
public function test(Foo $foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
}
public function test(Foo $foo, array $bar, $option = NULL, $extra = "lllllllllllllllllllllllllllllllllllllllllllllllllll") {
}
}
class Sub extends Base {
public function test() {
}
public function test() {
}
}
?>
--EXPECTF--

View file

@ -6,12 +6,12 @@ class Foo {
}
Abstract Class Base {
abstract public function test(Foo $foo, array $bar, $option = NULL, $extra = 16777215) ;
abstract public function test(Foo $foo, array $bar, $option = NULL, $extra = 16777215) ;
}
class Sub extends Base {
public function test(Foo $foo, array $bar, $option = NULL, $extra = 0xffffff ) {
}
public function test(Foo $foo, array $bar, $option = NULL, $extra = 0xffffff ) {
}
}
?>
--EXPECT--

View file

@ -3,8 +3,8 @@ Bug #55719 (Argument restriction should come with a more specific error message)
--FILE--
<?php
class Sub implements ArrayAccess {
public function offsetSet() {
}
public function offsetSet() {
}
}
?>
--EXPECTF--

View file

@ -3,13 +3,13 @@ Bug #60174 (Notice when array in method prototype error)
--FILE--
<?php
Abstract Class Base {
public function test($foo, $extra = array("test")) {
}
public function test($foo, $extra = array("test")) {
}
}
class Sub extends Base {
public function test($foo, $extra) {
}
public function test($foo, $extra) {
}
}
?>
--EXPECTF--

View file

@ -2,12 +2,12 @@
Tests that array manipulation code is correctly dealing with copy on write and splitting on reference
--FILE--
<?php
$a=array();
$b=1;
$c=&$b;
$a[]=$b;
$b=2;
var_dump ($a);
$a=array();
$b=1;
$c=&$b;
$a[]=$b;
$b=2;
var_dump ($a);
?>
--EXPECT--
array(1) {

View file

@ -4,12 +4,12 @@ Accept hashes being equal to zero
<?php
$hashes = [
"\x8e\x1a\x63\x0f\x61" => 32,
"\xf7\x17\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x6b\x03\x6a\x13\x63\x17\x6b\x1d\x67" => 64,
"\x8e\x1a\x63\x0f\x61" => 32,
"\xf7\x17\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x6b\x03\x6a\x13\x63\x17\x6b\x1d\x67" => 64,
];
foreach ($hashes as $hash => $bits) {
var_dump($hashes[$hash], $bits);
var_dump($hashes[$hash], $bits);
}
?>

View file

@ -5,13 +5,13 @@ Basic array unpacking
$array = [1, 2, 3];
function getArr() {
return [4, 5];
return [4, 5];
}
function arrGen() {
for($i = 11; $i < 15; $i++) {
yield $i;
}
for($i = 11; $i < 15; $i++) {
yield $i;
}
}
var_dump([...[]]);

View file

@ -4,23 +4,23 @@ Array unpacking with classes
<?php
class C {
public const FOO = [0, ...self::ARR, 4];
public const ARR = [1, 2, 3];
public static $bar = [...self::ARR];
public const FOO = [0, ...self::ARR, 4];
public const ARR = [1, 2, 3];
public static $bar = [...self::ARR];
}
class D {
public const A = [...self::B];
public const B = [...self::A];
public const A = [...self::B];
public const B = [...self::A];
}
var_dump(C::FOO);
var_dump(C::$bar);
try {
var_dump(D::A);
var_dump(D::A);
} catch (Error $ex) {
echo "Exception: " . $ex->getMessage() . "\n";
echo "Exception: " . $ex->getMessage() . "\n";
}
--EXPECT--
array(5) {

View file

@ -3,14 +3,14 @@ Array unpacking does not work with non-integer keys
--FILE--
<?php
function gen() {
yield [] => 1;
yield 1.23 => 123;
yield [] => 1;
yield 1.23 => 123;
}
try {
[...gen()];
[...gen()];
} catch (Error $ex) {
echo "Exception: " . $ex->getMessage() . "\n";
echo "Exception: " . $ex->getMessage() . "\n";
}
--EXPECT--

View file

@ -4,16 +4,16 @@ array unpacking with string keys (not supported)
<?php
try {
$array = [1, 2, "foo" => 3, 4];
var_dump([...$array]);
$array = [1, 2, "foo" => 3, 4];
var_dump([...$array]);
} catch (Error $ex) {
var_dump($ex->getMessage());
var_dump($ex->getMessage());
}
try {
$iterator = new ArrayIterator([1, 2, "foo" => 3, 4]);
var_dump([...$iterator]);
$iterator = new ArrayIterator([1, 2, "foo" => 3, 4]);
var_dump([...$iterator]);
} catch (Error $ex) {
var_dump($ex->getMessage());
var_dump($ex->getMessage());
}
--EXPECT--

View file

@ -2,12 +2,12 @@
Tests that array unshift code is correctly dealing with copy on write and splitting on reference
--FILE--
<?php
$a=array();
$b=1;
$c=&$b;
array_unshift ($a,$b);
$b=2;
var_dump ($a);
$a=array();
$b=1;
$c=&$b;
array_unshift ($a,$b);
$b=2;
var_dump ($a);
?>
--EXPECT--
array(1) {

View file

@ -6,137 +6,137 @@ assert.exception=0
--FILE--
<?php
assert(0 && ($a = function () {
global $a, $$b;
static $c, $d = 0;
unset($e);
$x = isset($a) && !empty($b) || eval($c);
$x = $a ? $b : $c;
$x = $a ?: $c;
$x = $a ?? $b;
list($a, $b, $c) = [1, 2=>'x', 'z'=>'c'];
@foo();
$y = clone $x;
yield 1 => 2;
yield from $x;
global $a, $$b;
static $c, $d = 0;
unset($e);
$x = isset($a) && !empty($b) || eval($c);
$x = $a ? $b : $c;
$x = $a ?: $c;
$x = $a ?? $b;
list($a, $b, $c) = [1, 2=>'x', 'z'=>'c'];
@foo();
$y = clone $x;
yield 1 => 2;
yield from $x;
}));
assert(0 && ($a = function &(array &$a, ?X $b = null) use ($c,&$d) : ?X {
abstract class A extends B implements C, D {
const X = 12;
const Y = self::X, Z = "aaa";
abstract class A extends B implements C, D {
const X = 12;
const Y = self::X, Z = "aaa";
public $a = 1, $b;
protected $c;
static private $d = null;
public $a = 1, $b;
protected $c;
static private $d = null;
abstract function foo();
abstract function foo();
static private function f1() {
for ($i = 0, $j = 100; $i < $j; $i++, --$j) {
$s[$i] = $a[$j];
}
foreach ($a as $key => &$val) {
print "$key => $val\n";
}
while ($s[$i]) {
$i++;
}
do {
$i--;
} while ($s[$i]);
$x = foo($a + 1, 4, ...[1,2,3]);
$x = ${$a . "_1"}();
$x = A::foo();
$x = ${$a . "_1"}::foo();
$x = A::${$a . "_1"}();
$x = $x->foo();
$x = ${$a . "_1"}->foo();
$x = $x->{$a . "_1"}();
$x->a = C::C;
${$a . "_1"}->a = ${$a . "_1"}::C;
$x->{a . "_1"} = C::C;
$x = C::$z;
$x = ${$a . "_1"}::$z;
$x = C::${$z . "_1"};
}
}
static private function f1() {
for ($i = 0, $j = 100; $i < $j; $i++, --$j) {
$s[$i] = $a[$j];
}
foreach ($a as $key => &$val) {
print "$key => $val\n";
}
while ($s[$i]) {
$i++;
}
do {
$i--;
} while ($s[$i]);
$x = foo($a + 1, 4, ...[1,2,3]);
$x = ${$a . "_1"}();
$x = A::foo();
$x = ${$a . "_1"}::foo();
$x = A::${$a . "_1"}();
$x = $x->foo();
$x = ${$a . "_1"}->foo();
$x = $x->{$a . "_1"}();
$x->a = C::C;
${$a . "_1"}->a = ${$a . "_1"}::C;
$x->{a . "_1"} = C::C;
$x = C::$z;
$x = ${$a . "_1"}::$z;
$x = C::${$z . "_1"};
}
}
}));
assert(0 && ($a = function &(array &$a, X $b = null, int|float $c) use ($c,&$d) : X {
final class A {
final protected function f2() {
if (!$x) {
return 0;
}
if ($x == 1) {
return 1;
} else if ($x == 2) {
return 2;
} else if ($x == 3) {
return 3;
} else {
if ($x == 9) {
return 9;
}
final class A {
final protected function f2() {
if (!$x) {
return 0;
}
if ($x == 1) {
return 1;
} else if ($x == 2) {
return 2;
} else if ($x == 3) {
return 3;
} else {
if ($x == 9) {
return 9;
}
L0:
do {
switch ($x) {
case 4: break;
case 5: continue;
case 6: break 2;
case 7: continue 2;
case 8: goto L0;
default: return;
}
} while (0);
}
}
}
switch ($x) {
case 4: break;
case 5: continue;
case 6: break 2;
case 7: continue 2;
case 8: goto L0;
default: return;
}
} while (0);
}
}
}
}));
assert(0 && ($a = function &(?array &$a, X $b = null) use ($c,&$d) : X {
class A {
use T1, T2 {
T1::foo insteadof foo;
T2::foo as bar;
baz as public;
ops as protected x;
}
use T3;
}
class A {
use T1, T2 {
T1::foo insteadof foo;
T2::foo as bar;
baz as public;
ops as protected x;
}
use T3;
}
}));
assert(0 && ($a = function &(array &...$a) {
declare(A=1,B=2);
try {
$i++;
} catch (MyException $e) {
echo 1;
} catch (Exception $e) {
echo 2;
} finally {
echo 3;
}
declare(A=1,B=2);
try {
$i++;
} catch (MyException $e) {
echo 1;
} catch (Exception $e) {
echo 2;
} finally {
echo 3;
}
}));
assert(0 && ($a = function () {
declare(C=1) { echo 1; }
$x = '\'"`$a';
$x = "'\"`$a";
$x = `'"\`$a`;
$x = "{$a}b";
$x = "${a}b";
$x = " {$foo->bar} ${$foo->bar} ";
$x = " ${'---'} ";
foo();
\foo();
namespace\foo();
$x = foo;
$x = \foo;
$x = namespace\foo;
$x = new foo();
$x = new \foo();
$x = new namespace\foo();
declare(C=1) { echo 1; }
$x = '\'"`$a';
$x = "'\"`$a";
$x = `'"\`$a`;
$x = "{$a}b";
$x = "${a}b";
$x = " {$foo->bar} ${$foo->bar} ";
$x = " ${'---'} ";
foo();
\foo();
namespace\foo();
$x = foo;
$x = \foo;
$x = namespace\foo;
$x = new foo();
$x = new \foo();
$x = new namespace\foo();
if ($a) {
} elseif ($b) {
}

View file

@ -6,8 +6,8 @@ assert.exception=0
--FILE--
<?php
assert(0 && ($a = function () {
$var = 'test';
$str = "$var, $var[1], {$var}[], {$var[1]}[], ${var}[], ${var[1]}[]";
$var = 'test';
$str = "$var, $var[1], {$var}[], {$var[1]}[], ${var}[], ${var[1]}[]";
}));
?>
--EXPECTF--

View file

@ -4,7 +4,7 @@ Assign to $this leaks when $this not defined
<?php
try {
$this->a = new stdClass;
$this->a = new stdClass;
} catch (Error $e) { echo $e->getMessage(), "\n"; }
?>

View file

@ -3,7 +3,7 @@
--FILE--
<?php
function foo () {
break 0;
break 0;
}
?>
--EXPECTF--

View file

@ -3,7 +3,7 @@
--FILE--
<?php
function foo () {
break $x;
break $x;
}
?>
--EXPECTF--

View file

@ -3,7 +3,7 @@
--FILE--
<?php
function foo () {
break;
break;
}
?>
--EXPECTF--

View file

@ -3,9 +3,9 @@
--FILE--
<?php
function foo () {
while (1) {
break 2;
}
while (1) {
break 2;
}
}
?>
--EXPECTF--

View file

@ -23,8 +23,8 @@ echo "\n";
setlocale(LC_ALL, "tr_TR.utf8");
foreach(get_declared_classes() as $class)
{
if(!class_exists($class))
echo "$class No Longer Exists!\n";
if(!class_exists($class))
echo "$class No Longer Exists!\n";
}
echo "Done.\n";

View file

@ -8,12 +8,12 @@ $t = new test;
$t->show_method();
class test {
static function show_static() {
echo "static\n";
}
function show_method() {
echo "method\n";
}
static function show_static() {
echo "static\n";
}
function show_method() {
echo "method\n";
}
}
?>
--EXPECT--

View file

@ -4,13 +4,13 @@ Bug #22836 (returning references to NULL)
<?php
function &f()
{
$x = "foo";
var_dump($x);
print "'$x'\n";
return ($a);
$x = "foo";
var_dump($x);
print "'$x'\n";
return ($a);
}
for ($i = 0; $i < 8; $i++) {
$h =& f();
$h =& f();
}
?>
--EXPECT--

View file

@ -4,7 +4,7 @@ Bug #23104 (Hash position not reset for constant arrays)
<?php
function foo($bar = array("a", "b", "c"))
{
var_dump(current($bar));
var_dump(current($bar));
}
foo();
?>

View file

@ -3,21 +3,21 @@ Bug #24635 (crash on dtor calling other functions)
--FILE--
<?php
class SiteClass {
function __construct() { $this->page = new PageClass(); }
function __construct() { $this->page = new PageClass(); }
}
class PageClass {
function Display() {
$section = new SectionClass("PageClass::Display");
}
function Display() {
$section = new SectionClass("PageClass::Display");
}
}
class SectionClass {
function __construct($comment) {
$this->Comment = $comment;
}
function __destruct() {
out($this->Comment); // this line doesn't crash PHP
out("\n<!-- End Section: " . $this->Comment . "-->"); // this line
}
function __construct($comment) {
$this->Comment = $comment;
}
function __destruct() {
out($this->Comment); // this line doesn't crash PHP
out("\n<!-- End Section: " . $this->Comment . "-->"); // this line
}
}
function out($code) { return; }
$site = new SiteClass();

View file

@ -2,8 +2,8 @@
Bug #24773 (unset() of integers treated as arrays causes a crash)
--FILE--
<?php
$array = 'test';
unset($array["lvl1"]["lvl2"]["b"]);
$array = 'test';
unset($array["lvl1"]["lvl2"]["b"]);
?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot use string offset as an array in %s:%d

View file

@ -3,9 +3,9 @@ Bug #26010 (private / protected variables get exposed by get_object_vars())
--FILE--
<?php
class foo {
private $private = 'private';
protected $protected = 'protected';
public $public = 'public';
private $private = 'private';
protected $protected = 'protected';
public $public = 'public';
}
$data = new foo();
$obj_vars = get_object_vars($data);

View file

@ -33,8 +33,8 @@ echo "===NONE===\n";
class NoneTest
{
function __toString() {
}
function __toString() {
}
}
$o = new NoneTest;
@ -48,16 +48,16 @@ echo "===THROW===\n";
class ErrorTest
{
function __toString() {
throw new Exception("This is an error!");
}
function __toString() {
throw new Exception("This is an error!");
}
}
$o = new ErrorTest;
try {
echo $o;
echo $o;
} catch (Exception $e) {
echo $e->getMessage(), "\n";
echo $e->getMessage(), "\n";
}
?>

View file

@ -13,14 +13,14 @@ $obj = new array_iterator;
try
{
foreach ($obj as $property => $value)
{
var_dump($value);
}
foreach ($obj as $property => $value)
{
var_dump($value);
}
}
catch(Exception $e)
{
echo $e->getMessage() . "\n";
echo $e->getMessage() . "\n";
}
?>
--EXPECT--

View file

@ -2,12 +2,12 @@
Bug #26281 (switch() crash when condition is a string offset)
--FILE--
<?php
$x = 'abc';
switch ($x[0]) {
case 'a':
echo "no crash\n";
break;
}
$x = 'abc';
switch ($x[0]) {
case 'a':
echo "no crash\n";
break;
}
?>
--EXPECT--
no crash

View file

@ -5,14 +5,14 @@ Bug #26696 (crash in switch() when string index is used)
$str = 'asdd/?';
$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
switch ($str[$i]) {
case '?':
echo "?+\n";
break;
default:
echo $str[$i].'-';
break;
}
switch ($str[$i]) {
case '?':
echo "?+\n";
break;
default:
echo $str[$i].'-';
break;
}
}
?>

View file

@ -4,9 +4,9 @@ Bug #26697 (calling class_exists on a nonexistent class in autoloader results in
<?php
spl_autoload_register(function ($name) {
echo __METHOD__ . "($name)\n";
var_dump(class_exists('NotExistingClass'));
echo __METHOD__ . "($name), done\n";
echo __METHOD__ . "($name)\n";
var_dump(class_exists('NotExistingClass'));
echo __METHOD__ . "($name), done\n";
});
var_dump(class_exists('NotExistingClass'));

View file

@ -7,56 +7,56 @@ ini_set("report_memleaks", 0); // the exception thrown in this test results in
class ObjectOne
{
function getNone()
{
throw new Exception('NONE');
}
function getNone()
{
throw new Exception('NONE');
}
}
class Proxy
{
function three($a, $b, $c)
{
}
function three($a, $b, $c)
{
}
function callOne()
{
try
{
$res = new ObjectOne();
$this->three($res->getNone());
}
catch(Exception $e)
{
echo 'Caught: '.$e->getMessage()."\n";
}
}
function callOne()
{
try
{
$res = new ObjectOne();
$this->three($res->getNone());
}
catch(Exception $e)
{
echo 'Caught: '.$e->getMessage()."\n";
}
}
function callTwo()
{
try
{
$res = new ObjectOne();
$this->three(1, $res->getNone());
}
catch(Exception $e)
{
echo 'Caught: '.$e->getMessage()."\n";
}
}
function callTwo()
{
try
{
$res = new ObjectOne();
$this->three(1, $res->getNone());
}
catch(Exception $e)
{
echo 'Caught: '.$e->getMessage()."\n";
}
}
function callThree()
{
try
{
$res = new ObjectOne();
$this->three(1, 2, $res->getNone());
}
catch(Exception $e)
{
echo 'Caught: '.$e->getMessage()."\n";
}
}
function callThree()
{
try
{
$res = new ObjectOne();
$this->three(1, 2, $res->getNone());
}
catch(Exception $e)
{
echo 'Caught: '.$e->getMessage()."\n";
}
}
}
$p = new Proxy();

View file

@ -6,14 +6,14 @@ Bug #26801 (switch ($a{0}) crash)
$a = '11';
$b = $a[0];
switch ($b) {
case '-':
break;
case '-':
break;
}
$a = '22';
switch ($a[0]) {
case '-':
break;
case '-':
break;
}
?>

View file

@ -5,7 +5,7 @@ Bug #26802 (Can't call static method using a variable)
function global_func()
{
echo __METHOD__ . "\n";
echo __METHOD__ . "\n";
}
$function = 'global_func';
@ -13,12 +13,12 @@ $function();
class foo
{
static $method = 'global_func';
static $method = 'global_func';
static public function foo_func()
{
echo __METHOD__ . "\n";
}
static public function foo_func()
{
echo __METHOD__ . "\n";
}
}
/* The following is a BC break with PHP 4 where it would

View file

@ -5,10 +5,10 @@ Bug #27304 (Static functions don't function properly)
class Staticexample
{
static function test()
{
var_dump(isset($this));
}
static function test()
{
var_dump(isset($this));
}
}
$b = new Staticexample();

View file

@ -2,13 +2,13 @@
Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dynamically)
--FILE--
<?php
class A {
static function hello() {
echo "Hello World\n";
}
}
$y[0] = 'hello';
A::{$y[0]}();
class A {
static function hello() {
echo "Hello World\n";
}
}
$y[0] = 'hello';
A::{$y[0]}();
?>
--EXPECTF--
Hello World

View file

@ -2,9 +2,9 @@
Bug #27731 (error_reporing() call inside @ block does not work correctly)
--FILE--
<?php
error_reporting(E_ALL ^ E_NOTICE);
@error_reporting(E_WARNING);
var_dump(error_reporting());
error_reporting(E_ALL ^ E_NOTICE);
@error_reporting(E_WARNING);
var_dump(error_reporting());
?>
--EXPECT--
int(2)

View file

@ -5,27 +5,27 @@ Bug #27798 (private / protected variables not exposed by get_object_vars() insid
class Base
{
public $Foo = 1;
protected $Bar = 2;
private $Baz = 3;
public $Foo = 1;
protected $Bar = 2;
private $Baz = 3;
function __construct()
{
echo __METHOD__ . "\n";
var_dump(get_object_vars($this));
}
function __construct()
{
echo __METHOD__ . "\n";
var_dump(get_object_vars($this));
}
}
class Child extends Base
{
private $Baz = 4;
private $Baz = 4;
function __construct()
{
parent::__construct();
echo __METHOD__ . "\n";
var_dump(get_object_vars($this));
}
function __construct()
{
parent::__construct();
echo __METHOD__ . "\n";
var_dump(get_object_vars($this));
}
}
var_dump(get_object_vars(new Base));

View file

@ -5,39 +5,39 @@ Bug #28444 (Cannot access undefined property for object with overloaded property
class ObjectOne
{
public $x;
public $x;
function __construct($x)
{
$this->x = $x;
}
function __construct($x)
{
$this->x = $x;
}
function __toString() {
return "Object";
}
function __toString() {
return "Object";
}
}
class Overloaded
{
public $props = array();
public $x;
public $props = array();
public $x;
function __construct($x)
{
$this->x = new ObjectOne($x);
}
function __construct($x)
{
$this->x = new ObjectOne($x);
}
function __get($prop)
{
echo __METHOD__ . "($prop)\n";
return $this->props[$prop];
}
function __get($prop)
{
echo __METHOD__ . "($prop)\n";
return $this->props[$prop];
}
function __set($prop, $val)
{
echo __METHOD__ . "($prop,$val)\n";
$this->props[$prop] = $val;
}
function __set($prop, $val)
{
echo __METHOD__ . "($prop,$val)\n";
$this->props[$prop] = $val;
}
}
$y = new Overloaded(2);
var_dump($y->x);

View file

@ -4,35 +4,35 @@ Bug #29210 (Function is_callable does not support private and protected methods)
<?php
class test_class {
private function test_func1() {
echo "test_func1\n";
echo "test_func1\n";
}
protected function test_func2() {
echo "test_func2\n";
echo "test_func2\n";
}
static private function test_func3() {
echo "test_func3\n";
echo "test_func3\n";
}
static protected function test_func4() {
echo "test_func4\n";
echo "test_func4\n";
}
function test() {
if (is_callable(array($this,'test_func1'))) {
$this->test_func1();
$this->test_func1();
} else {
echo "test_func1 isn't callable from inside\n";
}
if (is_callable(array($this,'test_func2'))) {
$this->test_func2();
$this->test_func2();
} else {
echo "test_func2 isn't callable from inside\n";
}
if (is_callable(array('test_class','test_func3'))) {
test_class::test_func3();
test_class::test_func3();
} else {
echo "test_func3 isn't callable from inside\n";
}
if (is_callable(array('test_class','test_func4'))) {
test_class::test_func4();
test_class::test_func4();
} else {
echo "test_func4 isn't callable from inside\n";
}
@ -42,22 +42,22 @@ class test_class {
class foo extends test_class {
function test() {
if (is_callable(array($this,'test_func1'))) {
$this->test_func1();
$this->test_func1();
} else {
echo "test_func1 isn't callable from child\n";
}
if (is_callable(array($this,'test_func2'))) {
$this->test_func2();
$this->test_func2();
} else {
echo "test_func2 isn't callable from child\n";
}
if (is_callable(array('test_class','test_func3'))) {
test_class::test_func3();
test_class::test_func3();
} else {
echo "test_func3 isn't callable from child\n";
}
if (is_callable(array('test_class','test_func4'))) {
test_class::test_func4();
test_class::test_func4();
} else {
echo "test_func4 isn't callable from child\n";
}
@ -67,12 +67,12 @@ class foo extends test_class {
$object = new test_class;
$object->test();
if (is_callable(array($object,'test_func1'))) {
$object->test_func1();
$object->test_func1();
} else {
echo "test_func1 isn't callable from outside\n";
}
if (is_callable(array($object,'test_func2'))) {
$object->test_func2();
$object->test_func2();
} else {
echo "test_func2 isn't callable from outside\n";
}

View file

@ -5,23 +5,23 @@ Bug #29368 (The destructor is called when an exception is thrown from the constr
class Foo
{
function __construct()
{
echo __METHOD__ . "\n";
throw new Exception;
}
function __destruct()
{
echo __METHOD__ . "\n";
}
function __construct()
{
echo __METHOD__ . "\n";
throw new Exception;
}
function __destruct()
{
echo __METHOD__ . "\n";
}
}
try
{
$bar = new Foo;
$bar = new Foo;
} catch(Exception $exc)
{
echo "Caught exception!\n";
echo "Caught exception!\n";
}
unset($bar);

View file

@ -3,16 +3,16 @@ Bug #29368.2 (The destructor is called when an exception is thrown from the cons
--FILE--
<?php
class Bomb {
function foo() {
}
function __destruct() {
throw new Exception("bomb!");
}
function foo() {
}
function __destruct() {
throw new Exception("bomb!");
}
}
try {
$x = new ReflectionMethod(new Bomb(), "foo");
$x = new ReflectionMethod(new Bomb(), "foo");
} catch (Throwable $e) {
echo $e->getMessage() . "\n";
echo $e->getMessage() . "\n";
}
echo "ok\n";
?>

View file

@ -3,27 +3,27 @@ Bug #29368.3 (The destructor is called when an exception is thrown from the cons
--FILE--
<?php
class Foo {
function __construct() {
echo __METHOD__ . "\n";
}
function __destruct() {
echo __METHOD__ . "\n";
}
function __construct() {
echo __METHOD__ . "\n";
}
function __destruct() {
echo __METHOD__ . "\n";
}
}
class Bar {
function __construct() {
echo __METHOD__ . "\n";
throw new Exception;
}
function __destruct() {
echo __METHOD__ . "\n";
}
function __construct() {
echo __METHOD__ . "\n";
throw new Exception;
}
function __destruct() {
echo __METHOD__ . "\n";
}
}
try {
new Foo() + new Bar();
new Foo() + new Bar();
} catch(Exception $exc) {
echo "Caught exception!\n";
echo "Caught exception!\n";
}
?>
--EXPECT--

View file

@ -5,18 +5,18 @@ Bug #29674 (inherited method doesn't have access to private variables of the der
class BaseClass
{
private $private_base = "Base";
private $private_base = "Base";
function printVars ()
{
var_dump($this->private_base);
var_dump($this->private_child);
}
function printVars ()
{
var_dump($this->private_base);
var_dump($this->private_child);
}
}
class ChildClass extends BaseClass
{
private $private_child = "Child";
private $private_child = "Child";
}
echo "===BASE===\n";

View file

@ -3,9 +3,9 @@ Bug #30140 (Problem with array in static properties)
--FILE--
<?php
class A {
public static $test1 = true;
public static $test2 = array();
public static $test3 = "str";
public static $test1 = true;
public static $test2 = array();
public static $test3 = "str";
}
class B extends A {

View file

@ -4,35 +4,35 @@ Bug #30162 (Catching exception in constructor couses lose of $this)
<?php
class FIIFO {
public function __construct() {
$this->x = "x";
throw new Exception;
}
public function __construct() {
$this->x = "x";
throw new Exception;
}
}
class hariCow extends FIIFO {
public function __construct() {
try {
parent::__construct();
} catch(Exception $e) {
}
$this->y = "y";
try {
$this->z = new FIIFO;
} catch(Exception $e) {
}
}
public function __construct() {
try {
parent::__construct();
} catch(Exception $e) {
}
$this->y = "y";
try {
$this->z = new FIIFO;
} catch(Exception $e) {
}
}
public function __toString() {
return "Rusticus in asino sedet.";
}
public function __toString() {
return "Rusticus in asino sedet.";
}
}
try {
$db = new FIIFO();
$db = new FIIFO();
} catch(Exception $e) {
}
var_dump($db);

View file

@ -4,17 +4,17 @@ Bug #30394 (Assignment operators yield wrong result with __get/__set)
<?php
class Container
{
public function __get( $what )
{
return $this->_p[ $what ];
}
public function __get( $what )
{
return $this->_p[ $what ];
}
public function __set( $what, $value )
{
$this->_p[ $what ] = $value;
}
public function __set( $what, $value )
{
$this->_p[ $what ] = $value;
}
private $_p = array();
private $_p = array();
}
$c = new Container();

View file

@ -4,8 +4,8 @@ Bug #30407 (Strange behaviour of default arguments)
<?php
function haricow($a = 'one') {
var_dump($a);
$a = 'two';
var_dump($a);
$a = 'two';
}
haricow();

View file

@ -5,25 +5,25 @@ Bug #30451 (static properties permissions broken)
class A {
protected static $property = TRUE;
protected static $property = TRUE;
protected static function method() {
return TRUE;
}
protected static function method() {
return TRUE;
}
}
class B extends A {
public function __construct() {
public function __construct() {
var_dump(self::method());
var_dump(parent::method());
var_dump(self::method());
var_dump(parent::method());
var_dump(self::$property);
var_dump(parent::$property);
var_dump(self::$property);
var_dump(parent::$property);
}
}
}

View file

@ -3,7 +3,7 @@ Bug #30702 (cannot initialize class variable from class constant)
--FILE--
<?php
class foo {
const C1=1;
const C1=1;
}
class bar extends foo {

View file

@ -3,23 +3,23 @@ Bug #30707 (Segmentation fault on exception in method)
--FILE--
<?php
class C {
function byePHP($plop) {
echo "ok\n";
}
function byePHP($plop) {
echo "ok\n";
}
function plip() {
try {
$this->plap($this->plop());
} catch(Exception $e) {
}
}
function plip() {
try {
$this->plap($this->plop());
} catch(Exception $e) {
}
}
function plap($a) {
}
function plap($a) {
}
function plop() {
throw new Exception;
}
function plop() {
throw new Exception;
}
}
$x = new C;

View file

@ -5,24 +5,24 @@ Bug #30725 (PHP segfaults when an exception is thrown in getIterator() within fo
class Test implements IteratorAggregate
{
function getIterator()
{
throw new Exception();
}
function getIterator()
{
throw new Exception();
}
}
try
{
$it = new Test;
foreach($it as $v)
{
echo "Fail\n";
}
echo "Wrong\n";
$it = new Test;
foreach($it as $v)
{
echo "Fail\n";
}
echo "Wrong\n";
}
catch(Exception $e)
{
echo "Caught\n";
echo "Caught\n";
}
?>

View file

@ -3,43 +3,43 @@ Bug #30828 (debug_backtrace() reports incorrect class in overridden methods)
--FILE--
<?php
class A {
function __construct() {
debug_print_backtrace();
$bt = debug_backtrace();
foreach ($bt as $t) {
print $t['class'].$t['type'].$t['function']."\n";
}
}
function __construct() {
debug_print_backtrace();
$bt = debug_backtrace();
foreach ($bt as $t) {
print $t['class'].$t['type'].$t['function']."\n";
}
}
function foo() {
debug_print_backtrace();
$bt = debug_backtrace();
foreach ($bt as $t) {
function foo() {
debug_print_backtrace();
$bt = debug_backtrace();
foreach ($bt as $t) {
print $t['class'].$t['type'].$t['function']."\n";
}
}
}
}
static function bar() {
debug_print_backtrace();
$bt = debug_backtrace();
foreach ($bt as $t) {
print $t['class'].$t['type'].$t['function']."\n";
}
}
static function bar() {
debug_print_backtrace();
$bt = debug_backtrace();
foreach ($bt as $t) {
print $t['class'].$t['type'].$t['function']."\n";
}
}
}
class B extends A {
function __construct() {
parent::__construct();
}
function __construct() {
parent::__construct();
}
function foo() {
parent::foo();
}
function foo() {
parent::foo();
}
static function bar() {
parent::bar();
}
static function bar() {
parent::bar();
}
}
$b = new B();

View file

@ -6,33 +6,33 @@ Bug #31102 (Exception not handled when thrown inside autoloader)
$test = 0;
spl_autoload_register(function ($class) {
global $test;
global $test;
echo __METHOD__ . "($class,$test)\n";
switch($test)
{
case 1:
eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
return;
case 2:
eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
throw new Exception(__METHOD__);
return;
case 3:
return;
}
echo __METHOD__ . "($class,$test)\n";
switch($test)
{
case 1:
eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
return;
case 2:
eval("class $class { function __construct(){throw new Exception('$class::__construct');}}");
throw new Exception(__METHOD__);
return;
case 3:
return;
}
});
while($test++ < 5)
{
try
{
eval("\$bug = new Test$test();");
}
catch (Exception $e)
{
echo "Caught: " . $e->getMessage() . "\n";
}
try
{
eval("\$bug = new Test$test();");
}
catch (Exception $e)
{
echo "Caught: " . $e->getMessage() . "\n";
}
}
?>
===DONE===

View file

@ -4,39 +4,39 @@ Bug #31177 (Memory leak)
<?php
class DbGow {
public function query() {
throw new Exception;
}
public function query() {
throw new Exception;
}
public function select() {
return new DbGowRecordSet($this->query());
}
public function select() {
return new DbGowRecordSet($this->query());
}
public function select2() {
new DbGowRecordSet($this->query());
}
public function select2() {
new DbGowRecordSet($this->query());
}
}
class DbGowRecordSet {
public function __construct($resource) {
}
public function __construct($resource) {
}
}
$db = new DbGow;
try {
$rs = $db->select();
$rs = $db->select();
} catch(Exception $e) {
echo "ok\n";
echo "ok\n";
}
try {
$db->select2();
$db->select2();
} catch(Exception $e) {
echo "ok\n";
echo "ok\n";
}
?>
--EXPECT--

View file

@ -3,18 +3,18 @@ Bug #31341 (escape on curly inconsistent)
--FILE--
<?php
$a = array(
"$ \{ ",
" \{ $",
" \{$ ",
" $\{ ",
" \$\{ ",
" \{\$ ",
"\$ \{ ",
" \{ \$",
"% \{ ");
"$ \{ ",
" \{ $",
" \{$ ",
" $\{ ",
" \$\{ ",
" \{\$ ",
"\$ \{ ",
" \{ \$",
"% \{ ");
foreach ($a as $v) {
echo("'$v'\n");
echo("'$v'\n");
}
?>
--EXPECT--

View file

@ -26,7 +26,7 @@ $a = new A();
}
catch(Exception $e)
{
echo "Caught\n";
echo "Caught\n";
}
?>

View file

@ -5,28 +5,28 @@ Bug #32252 (Segfault when offsetSet throws an Exception (only without debug))
class Test implements ArrayAccess
{
function offsetExists($offset)
{
echo __METHOD__ . "($offset)\n";
return false;
}
function offsetExists($offset)
{
echo __METHOD__ . "($offset)\n";
return false;
}
function offsetGet($offset)
{
echo __METHOD__ . "($offset)\n";
return null;
}
function offsetGet($offset)
{
echo __METHOD__ . "($offset)\n";
return null;
}
function offsetSet($offset, $value)
{
echo __METHOD__ . "($offset, $value)\n";
throw new Exception("Ooops");
}
function offsetSet($offset, $value)
{
echo __METHOD__ . "($offset, $value)\n";
throw new Exception("Ooops");
}
function offsetUnset($offset)
{
echo __METHOD__ . "($offset)\n";
}
function offsetUnset($offset)
{
echo __METHOD__ . "($offset)\n";
}
}
$list = new Test();
@ -36,7 +36,7 @@ try
}
catch (Exception $e)
{
echo "CAUGHT\n";
echo "CAUGHT\n";
}
?>

View file

@ -7,78 +7,78 @@ error_reporting=8191
class TestA
{
public function doSomething($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
public function doSomething($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
public function doSomethingThis($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
public function doSomethingThis($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
public function doSomethingParent($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
public function doSomethingParent($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
public function doSomethingParentThis($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
public function doSomethingParentThis($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
public static function doSomethingStatic($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
public static function doSomethingStatic($i)
{
echo __METHOD__ . "($i)\n";
return --$i;
}
}
class TestB extends TestA
{
public function doSomething($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array("TestA", "doSomething"), array($i));
}
public function doSomething($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array("TestA", "doSomething"), array($i));
}
public function doSomethingThis($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array($this, "TestA::doSomethingThis"), array($i));
}
public function doSomethingThis($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array($this, "TestA::doSomethingThis"), array($i));
}
public function doSomethingParent($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array("parent", "doSomethingParent"), array($i));
}
public function doSomethingParent($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array("parent", "doSomethingParent"), array($i));
}
public function doSomethingParentThis($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array($this, "parent::doSomethingParentThis"), array($i));
}
public function doSomethingParentThis($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array($this, "parent::doSomethingParentThis"), array($i));
}
public static function doSomethingStatic($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array("TestA", "doSomethingStatic"), array($i));
}
public static function doSomethingStatic($i)
{
echo __METHOD__ . "($i)\n";
$i++;
if ($i >= 5) return 5;
return call_user_func_array(array("TestA", "doSomethingStatic"), array($i));
}
}
$x = new TestB();

View file

@ -3,26 +3,26 @@ Bug #32296 (get_class_methods output has changed between 5.0.2 and 5.0.3)
--FILE--
<?php
abstract class space{
function __construct(){}
abstract protected function unfold();
function __construct(){}
abstract protected function unfold();
}
abstract class shape extends space{
private function x1() {}
protected final function unfold(){}
private function x1() {}
protected final function unfold(){}
}
abstract class quad extends shape{
private function x2() {}
function buggy(){
$c = get_class($this);
$a = get_class_methods(get_class($this));
$b = get_class_methods($this);
print($c."\n".'a:');
print_r($a);
print('b:');
print_r($b);
}
private function x2() {}
function buggy(){
$c = get_class($this);
$a = get_class_methods(get_class($this));
$b = get_class_methods($this);
print($c."\n".'a:');
print_r($a);
print('b:');
print_r($b);
}
}
class square extends quad{}

View file

@ -4,13 +4,13 @@ Bug #32427 (Interfaces are not allowed 'static' access modifier)
<?php
interface Example {
public static function sillyError();
public static function sillyError();
}
class ExampleImpl implements Example {
public static function sillyError() {
echo "I am a silly error\n";
}
public static function sillyError() {
echo "I am a silly error\n";
}
}
ExampleImpl::sillyError();

View file

@ -4,21 +4,21 @@ Bug #32429 (method_exists() always return TRUE if __call method exists)
<?php
class TestClass {
public function __construct() {
var_dump(method_exists($this, 'test'));
public function __construct() {
var_dump(method_exists($this, 'test'));
if (method_exists($this, 'test')) {
$this->test();
}
}
if (method_exists($this, 'test')) {
$this->test();
}
}
public function __call($name, $args) {
throw new Exception('Call to undefined method'.get_class($this).'::'.$name.'()');
}
public function __call($name, $args) {
throw new Exception('Call to undefined method'.get_class($this).'::'.$name.'()');
}
}
try {
$test = new TestClass;
$test = new TestClass;
} catch (Exception $e) {
exit($e->getMessage());
}

View file

@ -4,17 +4,17 @@ Bug #32660 (Assignment by reference causes crash when field access is overloaded
<?php
class A
{
public $q;
public $q;
function __construct()
{
$this->q = 3;//array();
}
function __construct()
{
$this->q = 3;//array();
}
function __get($name)
{
return $this->q;
}
function __get($name)
{
return $this->q;
}
}
$a = new A;

View file

@ -48,14 +48,14 @@ $obj = new class2();
$col = new collection();
try {
foreach($col as $co) {
//irrelevant
}
echo 'shouldn`t get here';
//$dummy = 'this will not crash';
$obj->dummy = 'this will crash';
foreach($col as $co) {
//irrelevant
}
echo 'shouldn`t get here';
//$dummy = 'this will not crash';
$obj->dummy = 'this will crash';
} catch (Exception $e) {
echo "ok\n";
echo "ok\n";
}
?>
--EXPECT--

View file

@ -5,13 +5,13 @@ Bug #32799 (crash: calling the corresponding global var during the destruct)
class test{
public $c=1;
function __destruct (){
if (!isset($GLOBALS['p'])) {
echo "NULL\n";
} else {
$GLOBALS['p']->c++; // no warning
print $GLOBALS['p']->c."\n"; // segfault
var_dump($GLOBALS['p']);
}
if (!isset($GLOBALS['p'])) {
echo "NULL\n";
} else {
$GLOBALS['p']->c++; // no warning
print $GLOBALS['p']->c."\n"; // segfault
var_dump($GLOBALS['p']);
}
}
}
$p=new test;

View file

@ -4,20 +4,20 @@ Bug #33171 (foreach enumerates private fields declared in base classes)
<?php
class A
{
private $c = "A's c";
private $c = "A's c";
}
class B extends A
{
private $c = "B's c";
private $c = "B's c";
public function go()
{
foreach ($this as $key => $val)
{
echo "$key => $val\n";
}
}
public function go()
{
foreach ($this as $key => $val)
{
echo "$key => $val\n";
}
}
};
$x = new B;

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