Skip to content

Commit e97817e

Browse files
committed
Fixed bug #35437 (Segfault or Invalid Opcode 137/1/4)
1 parent f49bc6b commit e97817e

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ PHP NEWS
44
- Fixed an error in mysqli_fetch_fields (returned NULL instead of an
55
array when row number > field_count). (Georg)
66
- Renamed CachingRecursiveIterator to RecursiveCachingIterator. (Marcus)
7+
- Fixed bug #35437 (Segfault or Invalid Opcode 137/1/4). (Dmitry)
78
- Fixed bug #35399 (Since fix of bug #35273 SOAP decoding of
89
soapenc:base64binary fails). (Dmitry)
910
- Fixed bug #35360 (exceptions in interactive mode (php -a) may cause crash).

Zend/tests/bug35437.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Bug #35437 Segfault or Invalid Opcode 137/1/4
3+
--FILE--
4+
<?php
5+
function err2exception($errno, $errstr)
6+
{
7+
throw new Exception("Error occuried: " . $errstr);
8+
}
9+
10+
set_error_handler('err2exception');
11+
12+
class TestClass
13+
{
14+
function testMethod()
15+
{
16+
$GLOBALS['t'] = new stdClass;
17+
}
18+
}
19+
20+
try {
21+
TestClass::testMethod();
22+
} catch (Exception $e) {
23+
echo "Catched: ".$e->getMessage()."\n";
24+
}
25+
?>
26+
--EXPECT--
27+
Catched: Error occuried: Non-static method TestClass::testMethod() should not be called statically

Zend/zend_execute.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,10 @@ ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
13841384
{
13851385
zend_execute_data execute_data;
13861386

1387+
if (EG(exception)) {
1388+
return;
1389+
}
1390+
13871391
/* Initialize execute_data */
13881392
EX(fbc) = NULL;
13891393
EX(object) = NULL;

0 commit comments

Comments
 (0)