mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
- Fix tests
This commit is contained in:
parent
23b97b2530
commit
288da2242e
@ -12,4 +12,4 @@ foo(123);
|
||||
--EXPECTF--
|
||||
3
|
||||
|
||||
Fatal error: Argument 1 passed to foo() must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
|
||||
Catchable fatal error: Argument 1 passed to foo() must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
|
||||
|
@ -2,6 +2,7 @@
|
||||
Bug #26166 (__toString() crash when no values returned)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Foo
|
||||
{
|
||||
function __toString()
|
||||
@ -28,6 +29,23 @@ class Bar
|
||||
$o = new Bar;
|
||||
echo $o;
|
||||
|
||||
echo "===NONE===\n";
|
||||
|
||||
function my_error_handler($errno, $errstr, $errfile, $errline) {
|
||||
var_dump($errstr);
|
||||
}
|
||||
|
||||
set_error_handler('my_error_handler');
|
||||
|
||||
class None
|
||||
{
|
||||
function __toString() {
|
||||
}
|
||||
}
|
||||
|
||||
$o = new None;
|
||||
echo $o;
|
||||
|
||||
echo "===THROW===\n";
|
||||
|
||||
class Error
|
||||
@ -45,23 +63,12 @@ catch (Exception $e) {
|
||||
echo "Got the exception\n";
|
||||
}
|
||||
|
||||
echo "===NONE===\n";
|
||||
|
||||
class None
|
||||
{
|
||||
function __toString() {
|
||||
}
|
||||
}
|
||||
|
||||
$o = new None;
|
||||
echo $o;
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
Hello World!
|
||||
===THROW===
|
||||
Got the exception
|
||||
===NONE===
|
||||
string(52) "Method None::__toString() must return a string value"
|
||||
===THROW===
|
||||
|
||||
Fatal error: Method None::__toString() must return a string value in %sbug26166.php on line %d
|
||||
Fatal error: Method Error::__toString() must not throw an exception in %sbug26166.php on line %d
|
||||
|
@ -3,6 +3,12 @@ Bug #28444 (Cannot access undefined property for object with overloaded property
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function my_error_handler($errno, $errstr, $errfile, $errline) {
|
||||
var_dump($errstr);
|
||||
}
|
||||
|
||||
set_error_handler('my_error_handler');
|
||||
|
||||
class Object
|
||||
{
|
||||
public $x;
|
||||
@ -60,7 +66,8 @@ Overloaded::__set(y,3)
|
||||
int(3)
|
||||
Overloaded::__get(y)
|
||||
int(3)
|
||||
Overloaded::__set(z,Object id #3)
|
||||
string(55) "Object of class Object could not be converted to string"
|
||||
Overloaded::__set(z,)
|
||||
object(Object)#%d (1) {
|
||||
["x"]=>
|
||||
int(4)
|
||||
@ -72,3 +79,27 @@ int(5)
|
||||
Overloaded::__get(z)
|
||||
int(6)
|
||||
===DONE===
|
||||
--UEXPECTF--
|
||||
object(Object)#%d (1) {
|
||||
[u"x"]=>
|
||||
int(2)
|
||||
}
|
||||
int(2)
|
||||
int(3)
|
||||
Overloaded::__set(y,3)
|
||||
int(3)
|
||||
Overloaded::__get(y)
|
||||
int(3)
|
||||
unicode(55) "Object of class Object could not be converted to string"
|
||||
Overloaded::__set(z,)
|
||||
object(Object)#%d (1) {
|
||||
[u"x"]=>
|
||||
int(4)
|
||||
}
|
||||
Overloaded::__get(z)
|
||||
int(4)
|
||||
Overloaded::__get(z)
|
||||
int(5)
|
||||
Overloaded::__get(z)
|
||||
int(6)
|
||||
===DONE===
|
||||
|
@ -2,22 +2,43 @@
|
||||
Bug #30791 magic methods (__sleep/__wakeup/__toString) call __call if object is overloaded
|
||||
--FILE--
|
||||
<?php
|
||||
class a {
|
||||
|
||||
function my_error_handler($errno, $errstr, $errfile, $errline) {
|
||||
var_dump($errstr);
|
||||
}
|
||||
|
||||
set_error_handler('my_error_handler');
|
||||
|
||||
class a
|
||||
{
|
||||
public $a = 4;
|
||||
function __call($a,$b) {
|
||||
return "unknown method";
|
||||
}
|
||||
}
|
||||
|
||||
$b = new a;
|
||||
echo $b,"\n";
|
||||
$c = unserialize(serialize($b));
|
||||
echo $c,"\n";
|
||||
var_dump($c);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Object id #1
|
||||
Object id #2
|
||||
string(50) "Object of class a could not be converted to string"
|
||||
|
||||
string(50) "Object of class a could not be converted to string"
|
||||
|
||||
object(a)#2 (1) {
|
||||
["a"]=>
|
||||
int(4)
|
||||
}
|
||||
--UEXPECT--
|
||||
unicode(50) "Object of class a could not be converted to string"
|
||||
|
||||
unicode(50) "Object of class a could not be converted to string"
|
||||
|
||||
object(a)#2 (1) {
|
||||
[u"a"]=>
|
||||
int(4)
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ function make_exception()
|
||||
|
||||
function make_exception_and_change_err_reporting()
|
||||
{
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_ALL & ~E_STRICT);
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ var_dump(error_reporting());
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(4095)
|
||||
int(4095)
|
||||
int(2047)
|
||||
int(8191)
|
||||
int(8191)
|
||||
int(6143)
|
||||
Done
|
||||
|
@ -1,7 +1,7 @@
|
||||
--TEST--
|
||||
Bug #33996 (No information given for fatal error on passing invalid value to typed argument)
|
||||
--INI--
|
||||
error_reporting=4095
|
||||
error_reporting=8191
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
@ -26,4 +26,5 @@ FooTest(new Foo());
|
||||
--EXPECTF--
|
||||
Warning: Missing argument 1 for NormalTest(), called in %sbug33996.php on line 17 and defined in %sbug33996.php on line 12
|
||||
Hi!
|
||||
Fatal error: Argument 1 passed to FooTest() must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
|
||||
Catchable fatal error: Argument 1 passed to FooTest() must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user