Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions Zend/tests/030.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ $test->bar();
object(Exception)#%d (7) {
["message":protected]=>
string(3) "foo"
["string":"Exception":private]=>
["string":"BaseException":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(%d) "%s030.php"
["line":protected]=>
int(%d)
["trace":"Exception":private]=>
["trace":"BaseException":private]=>
array(1) {
[0]=>
array(6) {
Expand All @@ -61,7 +61,7 @@ object(Exception)#%d (7) {
}
}
}
["previous":"Exception":private]=>
["previous":"BaseException":private]=>
NULL
}
'test' => '0'
Expand Down
16 changes: 10 additions & 6 deletions Zend/tests/arg_unpack/string_keys.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ set_error_handler(function($errno, $errstr) {
var_dump($errstr);
});

var_dump(...[1, 2, "foo" => 3, 4]);
var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
try {
var_dump(...[1, 2, "foo" => 3, 4]);
} catch (EngineException $ex) {
var_dump($ex->getMessage());
}
try {
var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
} catch (EngineException $ex) {
var_dump($ex->getMessage());
}

?>
--EXPECTF--
string(36) "Cannot unpack array with string keys"
int(1)
int(2)
string(42) "Cannot unpack Traversable with string keys"
int(1)
int(2)
14 changes: 6 additions & 8 deletions Zend/tests/bug37251.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
Bug #37251 (deadlock when custom error handler is to catch array type hint error)
--FILE--
<?php
function error_handler($errno, $errstr, $errfile, $errline, $context) {
echo 'OK';
}

set_error_handler('error_handler');

class Foo {
function bar(array $foo) {
}
}

$foo = new Foo();
$foo->bar();
try {
$foo = new Foo();
$foo->bar();
} catch (EngineException $e) {
echo 'OK';
}
--EXPECT--
OK
43 changes: 30 additions & 13 deletions Zend/tests/bug48693.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,43 @@ Bug #48693 (Double declaration of __lambda_func when lambda wrongly formatted)
--FILE--
<?php

$x = create_function('', 'return 1; }');
$y = create_function('', 'function a() { }; return 2;');
$z = create_function('', '{');
$w = create_function('', 'return 3;');
try {
$x = create_function('', 'return 1; }');
} catch (ParseException $e) {
echo "$e\n\n";
}
try {
$y = create_function('', 'function a() { }; return 2;');
} catch (ParseException $e) {
echo "$e\n\n";
}
try {
$z = create_function('', '{');
} catch (ParseException $e) {
echo "$e\n\n";
}
try {
$w = create_function('', 'return 3;');
} catch (ParseException $e) {
echo "$e\n\n";
}

var_dump(
$x,
$y(),
$z,
$w(),
$y != $z
$w()
);

?>
--EXPECTF--
Parse error: %s in %s(%d) : runtime-created function on line 1
exception 'ParseException' with message 'syntax error, unexpected '}', expecting end of file' in %sbug48693.php(4) : runtime-created function:1
Stack trace:
#0 %sbug48693.php(4): create_function('', 'return 1; }')
#1 {main}

exception 'ParseException' with message 'syntax error, unexpected end of file' in %sbug48693.php(14) : runtime-created function:1
Stack trace:
#0 %sbug48693.php(14): create_function('', '{')
#1 {main}

Parse error: %s %s(%d) : runtime-created function on line 1
bool(false)
int(2)
bool(false)
int(3)
bool(true)
2 changes: 1 addition & 1 deletion Zend/tests/bug64135.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function exception_error_handler() {
set_error_handler("exception_error_handler");
try {
$undefined->undefined();
} catch(Exception $e) {
} catch(BaseException $e) {
echo "Exception is thrown";
}
--EXPECT--
Expand Down
21 changes: 10 additions & 11 deletions Zend/tests/bug64966.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
Bug #64966 (segfault in zend_do_fcall_common_helper_SPEC)
--FILE--
<?php
error_reporting(E_ALL);
set_error_handler(function($error) { throw new Exception(); }, E_RECOVERABLE_ERROR);

function test($func) {
$a = $func("");
try {
$a = $func("");
} catch (EngineException $e) {
throw new Exception();
}
return true;
}
class A {
Expand All @@ -20,11 +21,9 @@ $a = new A();
$a->b();
?>
--EXPECTF--
Fatal error: Uncaught exception 'Exception' in %sbug64966.php:3
Fatal error: Uncaught exception 'Exception' in %sbug64966.php:6
Stack trace:
#0 [internal function]: {closure}(4096, 'Argument 1 pass...', '%s', 6, Array)
#1 %sbug64966.php(6): iterator_apply('')
#2 %sbug64966.php(12): test('iterator_apply')
#3 %sbug64966.php(17): A->b()
#4 {main}
thrown in %sbug64966.php on line 3
#0 %sbug64966.php(13): test('iterator_apply')
#1 %sbug64966.php(18): A->b()
#2 {main}
thrown in %sbug64966.php on line 6
7 changes: 5 additions & 2 deletions Zend/tests/closure_031.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ function foo($errno, $errstr, $errfile, $errline) {
set_error_handler('foo');
$foo = function() {
};
var_dump($foo->a);
try {
var_dump($foo->a);
} catch (EngineException $ex) {
echo "Error: {$ex->getMessage()}\n";
}
?>
--EXPECT--
Error: Closure object cannot have properties
NULL

14 changes: 7 additions & 7 deletions Zend/tests/exception_010.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ $x->getcode(1);

?>
--EXPECTF--
Warning: Exception::getTraceAsString() expects exactly 0 parameters, 1 given in %s on line %d
Warning: BaseException::getTraceAsString() expects exactly 0 parameters, 1 given in %s on line %d

Warning: Exception::__toString() expects exactly 0 parameters, 1 given in %s on line %d
Warning: BaseException::__toString() expects exactly 0 parameters, 1 given in %s on line %d

Warning: Exception::getTrace() expects exactly 0 parameters, 1 given in %s on line %d
Warning: BaseException::getTrace() expects exactly 0 parameters, 1 given in %s on line %d

Warning: Exception::getLine() expects exactly 0 parameters, 1 given in %s on line %d
Warning: BaseException::getLine() expects exactly 0 parameters, 1 given in %s on line %d

Warning: Exception::getFile() expects exactly 0 parameters, 1 given in %s on line %d
Warning: BaseException::getFile() expects exactly 0 parameters, 1 given in %s on line %d

Warning: Exception::getMessage() expects exactly 0 parameters, 1 given in %s on line %d
Warning: BaseException::getMessage() expects exactly 0 parameters, 1 given in %s on line %d

Warning: Exception::getCode() expects exactly 0 parameters, 1 given in %s on line %d
Warning: BaseException::getCode() expects exactly 0 parameters, 1 given in %s on line %d
14 changes: 7 additions & 7 deletions Zend/tests/exception_before_fatal.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@ set_error_handler("exception_error_handler");

try {
$foo->a();
} catch(Exception $e) {
} catch(BaseException $e) {
var_dump($e->getMessage());
}

try {
new $foo();
} catch(Exception $e) {
} catch(BaseException $e) {
var_dump($e->getMessage());
}

try {
throw $foo;
} catch(Exception $e) {
} catch(BaseException $e) {
var_dump($e->getMessage());
}

try {
$foo();
} catch(Exception $e) {
} catch(BaseException $e) {
var_dump($e->getMessage());
}

try {
$foo::b();
} catch(Exception $e) {
} catch(BaseException $e) {
var_dump($e->getMessage());
}


try {
$b = clone $foo;
} catch(Exception $e) {
} catch(BaseException $e) {
var_dump($e->getMessage());
}

Expand All @@ -50,7 +50,7 @@ class b {

try {
b::$foo();
} catch(Exception $e) {
} catch(BaseException $e) {
var_dump($e->getMessage());
}
?>
Expand Down
5 changes: 4 additions & 1 deletion Zend/tests/generators/bug67497.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ function gen() {
yield $a;
}

@eval('abc');
try {
eval('abc');
} catch (ParseException $ex) {
}

$values = gen();
$values->next();
Expand Down
18 changes: 0 additions & 18 deletions Zend/tests/methods-on-non-objects-args-catch.phpt

This file was deleted.

18 changes: 0 additions & 18 deletions Zend/tests/methods-on-non-objects-array-access.phpt

This file was deleted.

35 changes: 0 additions & 35 deletions Zend/tests/methods-on-non-objects-array-creation.phpt

This file was deleted.

Loading