mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix bug #81163 indirect vars in __sleep
This commit is contained in:
commit
7bf930d014
3 changed files with 25 additions and 1 deletions
2
NEWS
2
NEWS
|
@ -5,6 +5,8 @@ PHP NEWS
|
||||||
- Core:
|
- Core:
|
||||||
. Fixed bug #81145 (copy() and stream_copy_to_stream() fail for +4GB files).
|
. Fixed bug #81145 (copy() and stream_copy_to_stream() fail for +4GB files).
|
||||||
(cmb, Nikita)
|
(cmb, Nikita)
|
||||||
|
. Fixed bug #81163 (incorrect handling of indirect vars in __sleep).
|
||||||
|
(krakjoe)
|
||||||
|
|
||||||
- Intl:
|
- Intl:
|
||||||
. Fixed bug #72809 (Locale::lookup() wrong result with canonicalize option).
|
. Fixed bug #72809 (Locale::lookup() wrong result with canonicalize option).
|
||||||
|
|
22
ext/standard/tests/serialize/bug81163.phpt
Normal file
22
ext/standard/tests/serialize/bug81163.phpt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
--TEST--
|
||||||
|
Test __sleep returns non-array
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
class foo
|
||||||
|
{
|
||||||
|
private $private = 'private';
|
||||||
|
}
|
||||||
|
|
||||||
|
class bar extends foo
|
||||||
|
{
|
||||||
|
public function __sleep()
|
||||||
|
{
|
||||||
|
return (new bar());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
serialize(new bar());
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Notice: serialize(): "private" returned as member variable from __sleep() but does not exist in %s on line %d
|
||||||
|
|
|
@ -805,7 +805,7 @@ static int php_var_serialize_get_sleep_props(
|
||||||
zend_hash_init(ht, zend_hash_num_elements(sleep_retval), NULL, ZVAL_PTR_DTOR, 0);
|
zend_hash_init(ht, zend_hash_num_elements(sleep_retval), NULL, ZVAL_PTR_DTOR, 0);
|
||||||
/* TODO: Rewrite this by fetching the property info instead of trying out different
|
/* TODO: Rewrite this by fetching the property info instead of trying out different
|
||||||
* name manglings? */
|
* name manglings? */
|
||||||
ZEND_HASH_FOREACH_VAL(sleep_retval, name_val) {
|
ZEND_HASH_FOREACH_VAL_IND(sleep_retval, name_val) {
|
||||||
zend_string *name, *tmp_name, *priv_name, *prot_name;
|
zend_string *name, *tmp_name, *priv_name, *prot_name;
|
||||||
|
|
||||||
ZVAL_DEREF(name_val);
|
ZVAL_DEREF(name_val);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue