Skip to content

Commit 2860c3d

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix crashes in function registration + test
2 parents 12e4ee4 + 1235c74 commit 2860c3d

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ PHP NEWS
1515

1616
- Intl:
1717
. Fixed bug GH-11874 (intl causing segfault in docker images). (nielsdos)
18+
19+
- PHPDBG:
20+
. Fix crashes in function registration + test. (nielsdos, Girgias)
1821

1922
- SNMP:
2023
. Fixed bug GH-17330 (SNMP::setSecurity segfault on closed session).

sapi/phpdbg/phpdbg.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ static void php_phpdbg_destroy_bp_condition(zval *data) /* {{{ */
9090
efree(brake);
9191
} /* }}} */
9292

93-
static void php_phpdbg_destroy_registered(zval *data) /* {{{ */
94-
{
95-
zend_function_dtor(data);
96-
} /* }}} */
97-
9893
static void php_phpdbg_destroy_file_source(zval *data) /* {{{ */
9994
{
10095
phpdbg_file_source *source = (phpdbg_file_source *) Z_PTR_P(data);
@@ -164,7 +159,7 @@ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
164159
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP], 8, NULL, NULL, 0);
165160

166161
zend_hash_init(&PHPDBG_G(seek), 8, NULL, NULL, 0);
167-
zend_hash_init(&PHPDBG_G(registered), 8, NULL, php_phpdbg_destroy_registered, 0);
162+
zend_hash_init(&PHPDBG_G(registered), 8, NULL, NULL, true);
168163

169164
zend_hash_init(&PHPDBG_G(file_sources), 0, NULL, php_phpdbg_destroy_file_source, 0);
170165
phpdbg_setup_watchpoints();

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,6 @@ PHPDBG_COMMAND(register) /* {{{ */
14201420
if (!zend_hash_str_exists(&PHPDBG_G(registered), lcname, lcname_len)) {
14211421
if ((function = zend_hash_str_find_ptr(EG(function_table), lcname, lcname_len))) {
14221422
zend_hash_str_update_ptr(&PHPDBG_G(registered), lcname, lcname_len, function);
1423-
function_add_ref(function);
14241423

14251424
phpdbg_notice("Registered %s", lcname);
14261425
} else {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Test registering of functions
3+
--PHPDBG--
4+
R testfunc
5+
testfunc 1 2 3
6+
R var_dump
7+
var_dump foo
8+
q
9+
--FILE--
10+
<?php
11+
function testfunc() {
12+
var_dump(func_get_args());
13+
}
14+
?>
15+
--EXPECTF--
16+
[Successful compilation of %s]
17+
prompt> [Registered testfunc]
18+
prompt> array(3) {
19+
[0]=>
20+
int(1)
21+
[1]=>
22+
int(2)
23+
[2]=>
24+
int(3)
25+
}
26+
27+
prompt> [Registered var_dump]
28+
prompt> string(3) "foo"
29+
30+
prompt>

0 commit comments

Comments
 (0)