Skip to content

Commit 2fb8bb1

Browse files
committed
Fixed bug #70632 (Third one of segfault in gc_remove_from_buffer)
1 parent 6876112 commit 2fb8bb1

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ PHP NEWS
1515
. Fixed bug #70572 segfault in mysqlnd_connect. (Andrey, Remi)
1616

1717
- Opcache:
18+
. Fixed bug #70632 (Third one of segfault in gc_remove_from_buffer).
19+
(Laruence)
1820
. Fixed bug #70631 (Another Segfault in gc_remove_from_buffer()). (Laruence)
1921
. Fixed bug #70601 (Segfault in gc_remove_from_buffer()). (Laruence)
2022

Zend/zend_compile.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -3472,10 +3472,7 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
34723472
if (precv && precv->opcode == ZEND_RECV_INIT && precv->op2_type != IS_UNUSED) {
34733473
zval *zv, zv_copy;
34743474
int use_copy;
3475-
ALLOC_ZVAL(zv);
3476-
*zv = *precv->op2.zv;
3477-
zval_copy_ctor(zv);
3478-
INIT_PZVAL(zv);
3475+
zv = precv->op2.zv;
34793476
if ((Z_TYPE_P(zv) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
34803477
REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN_P(zv));
34813478
memcpy(offset, Z_STRVAL_P(zv), Z_STRLEN_P(zv));
@@ -3517,7 +3514,6 @@ static char * zend_get_function_declaration(zend_function *fptr TSRMLS_DC) /* {{
35173514
zval_dtor(&zv_copy);
35183515
}
35193516
}
3520-
zval_ptr_dtor(&zv);
35213517
}
35223518
} else {
35233519
memcpy(offset, "NULL", 4);

ext/opcache/tests/bug70632.phpt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #70632 (Third one of segfault in gc_remove_from_buffer)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.protect_memory=1
7+
--SKIPIF--
8+
<?php if (!extension_loaded('Zend OPcache')) die("skip"); ?>
9+
--FILE--
10+
<?php
11+
12+
class A {
13+
public function test($a = array("okey")) {
14+
}
15+
}
16+
17+
18+
eval ("class B extends A { public function test() {} }");
19+
?>
20+
--EXPECTF--
21+
Strict Standards: Declaration of B::test() should be compatible with A::test($a = Array) in %sbug70632.php(%d) : eval()'d code on line %d

0 commit comments

Comments
 (0)