Skip to content

Commit 49bd45a

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
2 parents b52a294 + bc9f2fb commit 49bd45a

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
. Fixed bug #66609 (php crashes with __get() and ++ operator in some cases).
77
(Dmitry, Laruence)
88
. Fixed bug #68917 (parse_url fails on some partial urls). (Wei Dai)
9+
. Fixed bug #69212 (Leaking VIA_HANDLER func when exception thrown in
10+
__call/... arg passing). (Nikita)
911

1012
- Filter:
1113
. Fixed bug #69202: (FILTER_FLAG_STRIP_BACKTICK ignored unless other

Zend/tests/bug69212.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Bug #69212: Leaking VIA_HANDLER func when exception thrown in __call/... arg passing
3+
--FILE--
4+
<?php
5+
6+
class Test {
7+
public static function __callStatic($method, $args) {}
8+
public function __call($method, $args) {}
9+
}
10+
11+
function do_throw() { throw new Exception; }
12+
13+
try {
14+
Test::foo(do_throw());
15+
} catch (Exception $e) {
16+
echo "Caught!\n";
17+
}
18+
try {
19+
(new Test)->bar(do_throw());
20+
} catch (Exception $e) {
21+
echo "Caught!\n";
22+
}
23+
24+
?>
25+
--EXPECT--
26+
Caught!
27+
Caught!

Zend/zend_vm_def.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5255,6 +5255,10 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
52555255
}
52565256
zval_ptr_dtor(&call->object);
52575257
}
5258+
if (call->fbc->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
5259+
efree((char *) call->fbc->common.function_name);
5260+
efree(call->fbc);
5261+
}
52585262
call--;
52595263
} while (call >= EX(call_slots));
52605264
EX(call) = NULL;

Zend/zend_vm_execute.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,10 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER
12141214
}
12151215
zval_ptr_dtor(&call->object);
12161216
}
1217+
if (call->fbc->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) {
1218+
efree((char *) call->fbc->common.function_name);
1219+
efree(call->fbc);
1220+
}
12171221
call--;
12181222
} while (call >= EX(call_slots));
12191223
EX(call) = NULL;

0 commit comments

Comments
 (0)