Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/tests/ArrayAccess/bug41209.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class env
{
public function __construct()
{
set_error_handler(array(__CLASS__, 'errorHandler'));
set_error_handler(array(__CLASS__, 'errorHandler'), delay: false);
}

public static function errorHandler($errno, $errstr, $errfile, $errline)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set_error_handler(function (int $errno, string $errstr, ?string $errfile = null, ?int $errline = null) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
});
}, delay: false);

class Clazz {
#[\Deprecated(self::TEST)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set_error_handler(function (int $errno, string $errstr, ?string $errfile = null, ?int $errline = null) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
});
}, delay: false);

#[\Deprecated(TEST)]
const TEST = "from itself";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set_error_handler(function (int $errno, string $errstr, ?string $errfile = null, ?int $errline = null) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
});
}, delay: false);

#[\Deprecated("convert to exception")]
function test() {
Expand Down Expand Up @@ -76,7 +76,7 @@ class Destructor {
}

try {
new Destructor();
(function () { new Destructor(); })();
} catch (ErrorException $e) {
echo "Caught: ", $e->getMessage(), PHP_EOL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ try {
}
?>
--EXPECTF--
ERR#2: include(class://non.existent.Class): Failed to open stream: "CLWrapper::stream_open" call failed @ include
ERR#2: include(): Failed opening 'class://non.existent.Class' for inclusion (include_path='%s') @ include
ERR#2: include(class://non.existent.Class): Failed to open stream: "CLWrapper::stream_open" call failed @ __construct
ERR#2: include(): Failed opening 'class://non.existent.Class' for inclusion (include_path='.:') @ __construct

Fatal error: Uncaught Exception: Failed loading class://non.existent.Class in %s
Stack trace:
Expand Down
6 changes: 4 additions & 2 deletions Zend/tests/bind_static_exception.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ class Test {
}
}
try {
$new = new Test;
static $new;
(function () {
$new = new Test;
static $new;
})();
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bitwise_not_precision_exception.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Promoting float precision warning to exception in bitwise_not
<?php
set_error_handler(function($_, $msg) {
throw new Exception($msg);
});
}, delay: false);
try {
var_dump(~INF);
} catch (Exception $e) {
Expand Down
3 changes: 1 addition & 2 deletions Zend/tests/bug29896.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ GenerateError2("Test2");
?>
--EXPECTF--
#0 %s(%d): userErrorHandler(2, 'Undefined varia...', '%s', %d)
#1 %s(%d): GenerateError1('Test1')
#2 %s(%d): GenerateError2('Test2')
#1 %s(%d): GenerateError2('Test2')
1 change: 1 addition & 0 deletions Zend/tests/bug38220.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class A {
$drv = myserv::drv();

$drv->obj = $this;
(function (){})();

echo "before call $method\n";
print_r($this);
Expand Down
5 changes: 4 additions & 1 deletion Zend/tests/bug49893.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ class B {
throw new Exception("1");
}
}
try {
function f() {
$b = new B();
}
try {
f();
} catch(Exception $e) {
echo $e->getMessage() . "\n";
}
Expand Down
2 changes: 2 additions & 0 deletions Zend/tests/bug52041.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--TEST--
Bug #52041 (Memory leak when writing on uninitialized variable returned from function)
--INI--
opcache.jit=0
--FILE--
<?php
function foo() {
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug60909_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ register_shutdown_function(function(){echo("\n\n!!!shutdown!!!\n\n");});
set_error_handler(function($errno, $errstr, $errfile, $errline){
echo "error($errstr)";
throw new Exception("Foo");
});
}, delay: false);

require 'notfound.php';
?>
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug61767.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bug #61767 (Shutdown functions not called in certain error situation)
set_error_handler(function($code, $msg, $file = null, $line = null) {
echo "Error handler called ($msg)\n";
throw new \ErrorException($msg, $code, 0, $file, $line);
});
}, delay: false);

register_shutdown_function(function(){
echo "Shutting down\n";
Expand Down
6 changes: 6 additions & 0 deletions Zend/tests/bug63206.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ set_error_handler(function() {
echo 'Internal handler' . PHP_EOL;
});

global $tmp;
$triggerInternalNotice++; // warnings while handling the error should go into internal handler
fwrite($tmp, "."); // handle errors

restore_error_handler();
});

$tmp = tmpfile();

$triggerNotice1++;
fwrite($tmp, "."); // handle errors
$triggerNotice2++;
fwrite($tmp, "."); // handle errors
?>
--EXPECT--
Second handler
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug70662.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ var_dump($a);
--EXPECT--
array(1) {
["b"]=>
int(2)
int(1)
}
2 changes: 1 addition & 1 deletion Zend/tests/bug70785.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bug #70785 (Infinite loop due to exception during identical comparison)

set_error_handler(function($no, $msg) {
throw new Exception($msg);
});
}, delay: false);

try {
if ($a === null) { // ZEND_VM_SMART_BRANCH
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug72101.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Mock_MethodCallbackByReference_7b180d26 extends MethodCallbackByReference
set_error_handler(function() {
// var_dump(func_get_args());
DoesNotExists::$nope = true;
}, E_ALL);
}, E_ALL, delay: false);

$foo = new Mock_MethodCallbackByReference_7b180d26();
$InvMocker = new PHPUnit_Framework_MockObject_InvocationMocker();
Expand Down
7 changes: 3 additions & 4 deletions Zend/tests/bug74164.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ namespace Foo;

set_error_handler(function ($type, $msg) {
throw new \Exception($msg);
});
}, delay: false);

call_user_func(function (array &$ref) {var_dump("xxx");}, 'not_an_array_variable');
?>
--EXPECTF--
Fatal error: Uncaught Exception: {closure:%s:%d}(): Argument #1 ($ref) must be passed by reference, value given in %s:%d
Stack trace:
#0 [internal function]: {closure:%s:%d}(2, '%s', '%s', 9)
#1 %sbug74164.php(%d): call_user_func(%s)
#2 {main}
#0 %s(%d): {closure:%s:%d}(2, '{closure:%s', '%s', 9)
#1 {main}
thrown in %sbug74164.php on line %d
2 changes: 1 addition & 1 deletion Zend/tests/bug76534.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bug #76534 (PHP hangs on 'illegal string offset on string references with an err
<?php
set_error_handler(function ($severity, $message, $file, $line) {
throw new \Exception($message);
});
}, delay: false);

$x = "foo";
$y = &$x["2bar"];
Expand Down
34 changes: 30 additions & 4 deletions Zend/tests/bug78598.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--TEST--
Bug #78598: Changing array during undef index RW error segfaults
--INI--
opcache.jit=0
--FILE--
<?php

Expand All @@ -25,7 +27,31 @@ var_dump($my_var);

?>
--EXPECT--
int(0)
int(0)
int(0)
int(0)
array(1) {
[0]=>
string(3) "xyz"
}
array(1) {
[0]=>
array(1) {
[0]=>
array(1) {
[0]=>
string(3) "xyz"
}
}
}
array(1) {
["foo"]=>
string(3) "xyz"
}
array(1) {
["foo"]=>
array(1) {
["bar"]=>
array(1) {
["baz"]=>
string(3) "xyz"
}
}
}
2 changes: 1 addition & 1 deletion Zend/tests/bug79599.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Bug #79599 (coredump in set_error_handler)
<?php
set_error_handler(function($code, $message){
throw new \Exception($message);
});
}, delay: false);
function test1(){
$a[] = $b;
}
Expand Down
18 changes: 15 additions & 3 deletions Zend/tests/bug79784.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ var_dump($a);

?>
--EXPECT--
NULL
NULL
NULL
array(1) {
[""]=>
string(1) "x"
}
array(1) {
[""]=>
string(1) "x"
}
array(1) {
[""]=>
array(1) {
[""]=>
string(1) "x"
}
}
4 changes: 2 additions & 2 deletions Zend/tests/bug79793.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ var_dump($ary);

?>
--EXPECT--
Undefined array key "foobar"
array(1) {
["foobar"]=>
int(1)
}
Undefined array key "foobarbaz"
Undefined array key "foobar"
array(2) {
["foobar"]=>
int(1)
["foobarbaz"]=>
int(1)
}
Undefined array key "foobarbaz"
2 changes: 1 addition & 1 deletion Zend/tests/closures/closure_031.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ try {
}
?>
--EXPECT--
Warning: Undefined property: Closure::$a
NULL
Warning: Undefined property: Closure::$a
1 change: 1 addition & 0 deletions Zend/tests/coalesce/assign_coalesce_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class Dtor {
$ary = new AA;
try {
$ary[new Dtor][id($foo)] ??= $bar;
(function () {})();
} catch (Exception $e) {
echo $e->getMessage(), "\n";
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/compound_assign_failure.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ try {
$a <<= -1;
} catch (Error $e) { var_dump($a); }

set_error_handler(function($type, $msg) { throw new Exception($msg); });
set_error_handler(function($type, $msg) { throw new Exception($msg); }, delay: false);

try {
$a = [];
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/concat/bug81705.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ $my_var .= $GLOBALS["arr"];
var_dump($my_var);
?>
--EXPECT--
string(6) "aArray"
error
string(6) "aArray"
1 change: 1 addition & 0 deletions Zend/tests/constants/gh18463-class-constant.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ set_error_handler('handler');
var_dump(_ZendTestClass::ZEND_TEST_DEPRECATED);
?>
--EXPECTF--
int(42)
Constant _ZendTestClass::ZEND_TEST_DEPRECATED is deprecated in %s on line %d

Fatal error: Cannot use "string" as a class name as it is reserved in %s(%d) : eval()'d code on line %d
4 changes: 2 additions & 2 deletions Zend/tests/debug_info/recursion_return_null.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ var_dump($f);

?>
--EXPECTF--
object(Foo)#%d (0) {
}
in handler

Deprecated: Returning null from Foo::__debugInfo() is deprecated, return an empty array instead in %s on line %d
object(Foo)#3 (0) {
}
object(Foo)#2 (0) {
}
43 changes: 43 additions & 0 deletions Zend/tests/delayed_error_001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--TEST--
Delayed error 001
--INI--
opcache.jit=0
--FILE--
<?php
$array[0][1] .= 'foo';
$array[2][3]++;
$array[3][4]--;
++$array[5][6];
--$array[7][8];
$array[9][10] += 42;
?>
--EXPECTF--
Warning: Undefined variable $array in %s on line %d

Warning: Undefined array key 0 in %s on line %d

Warning: Undefined array key 1 in %s on line %d

Warning: Undefined array key 2 in %s on line %d

Warning: Undefined array key 3 in %s on line %d

Warning: Undefined array key 3 in %s on line %d

Warning: Undefined array key 4 in %s on line %d

Warning: Decrement on type null has no effect, this will change in the next major version of PHP in %s on line %d

Warning: Undefined array key 5 in %s on line %d

Warning: Undefined array key 6 in %s on line %d

Warning: Undefined array key 7 in %s on line %d

Warning: Undefined array key 8 in %s on line %d

Warning: Decrement on type null has no effect, this will change in the next major version of PHP in %s on line %d

Warning: Undefined array key 9 in %s on line %d

Warning: Undefined array key 10 in %s on line %d
Loading
Loading