Skip to content

Commit eb03f16

Browse files
committed
Fixed bug #74408 (Endless loop bypassing execution time limit)
1 parent dd17659 commit eb03f16

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2017 PHP 7.0.19
44

5+
- Core:
6+
. Fixed bug #74408 (Endless loop bypassing execution time limit). (Laruence)
7+
58
- Date:
69
. Fixed bug #74404 (Wrong reflection on DateTimeZone::getTransitions).
710
(krakjoe)

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
@@ -755,6 +755,15 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
755755
}
756756
zend_error(E_DEPRECATED, "%s", error);
757757
efree(error);
758+
if (UNEXPECTED(EG(exception))) {
759+
if (callable_name) {
760+
zend_string_release(callable_name);
761+
}
762+
if (EG(current_execute_data) == &dummy_execute_data) {
763+
EG(current_execute_data) = dummy_execute_data.prev_execute_data;
764+
}
765+
return FAILURE;
766+
}
758767
}
759768
zend_string_release(callable_name);
760769
}

0 commit comments

Comments
 (0)