Skip to content

Commit 87e6e19

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fixed bug #74408 (Endless loop bypassing execution time limit)
2 parents 3dc9279 + eb03f16 commit 87e6e19

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

Zend/tests/bug74408.phpt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
--TEST--
2+
Bug #74408 (Endless loop bypassing execution time limit)
3+
--INI--
4+
error_reporting = E_ALL | E_DEPRECATED | E_STRICT
5+
--FILE--
6+
<?php
7+
8+
//php.ini: error_reporting = E_ALL | E_DEPRECATED | E_STRICT
9+
10+
class ErrorHandling {
11+
12+
public function error_handler($errno, $errstr, $errfile, $errline) {
13+
$bla = new NonExistingClass2();
14+
}
15+
16+
public function exception_handler(Error $e) {
17+
echo "Caught, exception: " . $e->getMessage();
18+
}
19+
}
20+
21+
set_error_handler('ErrorHandling::error_handler');
22+
set_exception_handler('ErrorHandling::exception_handler');
23+
24+
$blubb = new NonExistingClass();
25+
?>
26+
--EXPECTF--
27+
Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in %sbug74408.php on line %d
28+
29+
Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in %sbug74408.php on line %d
30+
31+
Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in Unknown on line 0
32+
33+
Fatal error: Uncaught Error: Class 'NonExistingClass2' not found in %sbug74408.php:%d
34+
Stack trace:
35+
#0 [internal function]: ErrorHandling::error_handler(8192, 'Non-static meth...', '%s', %d, Array)
36+
#1 %sbug74408.php(%d): set_exception_handler('ErrorHandling::...')
37+
#2 {main}
38+
thrown in %sbug74408.php on line %d

Zend/zend_execute_API.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,15 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
748748
}
749749
zend_error(E_DEPRECATED, "%s", error);
750750
efree(error);
751+
if (UNEXPECTED(EG(exception))) {
752+
if (callable_name) {
753+
zend_string_release(callable_name);
754+
}
755+
if (EG(current_execute_data) == &dummy_execute_data) {
756+
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
757+
}
758+
return FAILURE;
759+
}
751760
}
752761
zend_string_release(callable_name);
753762
}

0 commit comments

Comments
 (0)