Skip to content

Commit e308dc0

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix phpGH-10251: Assertion `(flag & (1<<3)) == 0' failed. Fix phpGH-9710: phpdbg memory leaks by option "-h"
2 parents 32f503e + d03025b commit e308dc0

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PHP NEWS
55
- Core:
66
. Fixed bug GH-10200 (zif_get_object_vars:
77
Assertion `!(((__ht)->u.flags & (1<<2)) != 0)' failed). (nielsdos)
8+
. Fix GH-10251 (Assertion `(flag & (1<<3)) == 0' failed). (nielsdos)
89

910
- FPM:
1011
. Fixed bug #77106 (Missing separator in FPM FastCGI errors). (Jakub Zelenka)
@@ -26,6 +27,7 @@ PHP NEWS
2627
- PHPDBG:
2728
. Fix undefined behaviour in phpdbg_load_module_or_extension(). (nielsdos)
2829
. Fix NULL pointer dereference in phpdbg_create_conditional_breal(). (nielsdos)
30+
. Fix GH-9710: phpdbg memory leaks by option "-h" (nielsdos)
2931

3032
- Posix:
3133
. Fix memory leak in posix_ttyname() (girgias)

Zend/tests/gh10251.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
GH-10251 (Assertion `(flag & (1<<3)) == 0' failed.)
3+
--FILE--
4+
<?php
5+
class A
6+
{
7+
function __set($o, $l)
8+
{
9+
$this->$p = $v;
10+
}
11+
}
12+
$a = new A();
13+
$pp = "";
14+
$op = $pp & "";
15+
// Bitwise operators on strings don't compute the hash.
16+
// The code below previously assumed a hash was actually computed, leading to a crash.
17+
$a->$op = 0;
18+
echo "Done\n";
19+
?>
20+
--EXPECTF--
21+
Warning: Undefined variable $v in %s on line %d
22+
23+
Warning: Undefined variable $p in %s on line %d
24+
Done

Zend/zend_object_handlers.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,8 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
553553
if (EXPECTED(Z_TYPE_P(zv) == IS_STRING)) {
554554
zend_string *str = Z_STR_P(zv);
555555
if (EXPECTED(str == member) ||
556-
/* "str" always has a pre-calculated hash value here */
557-
(EXPECTED(ZSTR_H(str) == zend_string_hash_val(member)) &&
558-
EXPECTED(zend_string_equal_content(str, member)))) {
556+
/* str and member don't necessarily have a pre-calculated hash value here */
557+
EXPECTED(zend_string_equal_content(str, member))) {
559558
return &Z_PROPERTY_GUARD_P(zv);
560559
} else if (EXPECTED(Z_PROPERTY_GUARD_P(zv) == 0)) {
561560
zval_ptr_dtor_str(zv);

sapi/phpdbg/phpdbg.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,8 @@ int main(int argc, char **argv) /* {{{ */
13781378
get_zend_version()
13791379
);
13801380
}
1381+
PHPDBG_G(flags) |= PHPDBG_IS_QUITTING;
1382+
php_module_shutdown();
13811383
sapi_deactivate();
13821384
sapi_shutdown();
13831385
php_ini_builder_deinit(&ini_builder);

0 commit comments

Comments
 (0)