php-src/ext/standard
Ilija Tovilo d7d36692fd
Fix serialization of RC1 objects appearing in object graph twice
Previously, if an object had RC1 it would never be recorded in
php_serialize_data.ht because it was assumed that it could not be encountered
again. This assumption is incorrect though as the object itself may be saved
inside an array with RCn. This results in a new instance of the object, instead
of a second reference to the same object.

This is solved by tracking these objects in php_serialize_data.ht. To retain
performance, track if the current object resides in a potentially nested RCn
array. If not, and if the object is RC1 itself it may be omitted from
php_serialize_data.ht.

Additionally, we may treat the array root itself as RC1 because it may not
appear in the object graph again without recursion. Recursive arrays are still
somewhat broken even with this change, as the tracking of the array only happens
when the reference is encountered, thus resulting in a -> a' -> a' for a self
recursive array a -> a. Recursive arrays have limited support in serialize
anyway, so we ignore this case for now.

Co-authored-by: Dmitry Stogov <dmitry@zend.com>
Co-authored-by: Martin Hoch <martin@littlerobot.de>

Closes GH-11349
Closes GH-11305
2023-06-28 21:15:03 +02:00
..
html_tables Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
tests Fix serialization of RC1 objects appearing in object graph twice 2023-06-28 21:15:03 +02:00
array.c Fix exception handling in array_multisort() 2023-05-24 13:55:25 +02:00
assert.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
base64.c Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
base64.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
basic_functions_arginfo.h Fix GH-10292 1st param of mt_srand() has UNKNOWN default on PHP <8.3 2023-01-24 19:05:33 +01:00
basic_functions.c Fix GH-9905: constant() behaves inconsistent when class is undefined 2022-11-09 15:21:50 +01:00
basic_functions.h Use zend_string for putenv key (#7379) 2021-08-17 12:29:04 +02:00
basic_functions.stub.php Fix GH-10292 1st param of mt_srand() has UNKNOWN default on PHP <8.3 2023-01-24 19:05:33 +01:00
browscap.c Fix GH-10052: Browscap crashes PHP 8.1.12 on request shutdown (apache2) 2023-03-20 20:49:21 +01:00
config.m4 Merge branch 'PHP-8.0' into PHP-8.1 2022-07-15 12:48:09 +01:00
config.w32 Merge branch 'PHP-7.4' into PHP-8.0 2020-10-26 11:06:10 +01:00
crc32_x86.c Zend/zend_cpuinfo, ext/standard/crc32_x86: fix -Wstrict-prototypes 2023-02-07 22:47:43 +00:00
crc32_x86.h X86: Fast CRC32 computation using PCLMULQDQ instruction 2020-09-02 15:10:41 +02:00
crc32.c Fix pointer constness warning in crc32 module on arm64 (#7225) 2021-07-09 15:29:36 +02:00
crc32.h phar: crc32: Extend and cleanup API for the new bulk crc32 functions 2021-07-03 21:03:47 +02:00
credits_ext.h Update CREDITS 2020-06-17 13:04:01 +00:00
credits_sapi.h Update CREDITS for PHP 7.2.30 2020-04-14 15:16:26 +00:00
credits.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
credits.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
crypt_blowfish.c crypt: Fix validation of malformed BCrypt hashes 2023-02-12 20:46:44 -07:00
crypt_blowfish.h Clean house in cryptographic hashing code 2020-06-24 13:40:27 +02:00
crypt_freesec.c Clean house in cryptographic hashing code 2020-06-24 13:40:27 +02:00
crypt_freesec.h
crypt_sha256.c Merge branch 'PHP-8.0' into PHP-8.1 2022-07-01 05:34:05 +01:00
crypt_sha512.c Merge branch 'PHP-8.0' into PHP-8.1 2022-07-01 05:34:05 +01:00
crypt.c Merge branch 'PHP-8.0' into PHP-8.1 2023-02-12 21:33:39 -07:00
css.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
css.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
datetime.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
datetime.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
dir_arginfo.h Declare Directory properties 2021-08-19 10:39:23 +02:00
dir.c Declare Directory properties 2021-08-19 10:39:23 +02:00
dir.stub.php Declare Directory properties 2021-08-19 10:39:23 +02:00
dl_arginfo.h Include stub hash in generated arginfo files 2020-06-24 09:55:19 +02:00
dl.c Disable zend_rc_debug during dtor of dl()'ed module (#8606) 2022-05-24 19:22:55 +02:00
dl.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
dl.stub.php Add stubs for some SAPIs 2020-05-14 13:35:12 +02:00
dns_win32.c Merge branch 'PHP-8.0' 2021-08-30 18:55:16 +02:00
dns.c Fix GH-7748: gethostbyaddr outputs binary string 2021-12-10 17:38:36 +01:00
exec.c Remove 'register' type qualifier (#6980) 2021-05-14 13:38:01 +01:00
exec.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
file.c Propagate STREAM_DISABLE_OPEN_BASEDIR src flag to php_stream_stat_path_ex 2023-04-30 13:36:15 +02:00
file.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
filestat.c Merge branch 'PHP-8.0' into PHP-8.1 2022-03-04 16:07:54 +01:00
filters.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
flock_compat.c Merge branch 'PHP-8.0' 2021-07-06 12:03:55 +02:00
flock_compat.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
formatted_print.c Merge branch 'PHP-8.0' into PHP-8.1 2021-09-29 12:21:49 +02:00
fsock.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
fsock.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
ftok.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
ftp_fopen_wrapper.c Fix context option check for "overwrite" in FTP 2023-06-27 17:53:45 +02:00
head.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
head.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
hrtime.c Revert "hrtime implementation update for Mac" 2021-06-14 14:27:35 +02:00
hrtime.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
html_tables.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
html.c Fix incorrect check in cs_8559_5 in map_from_unicode() 2023-01-25 00:08:28 +00:00
html.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
http_fopen_wrapper.c Fix GH-11274: POST/PATCH request via file_get_contents + stream_context_create switches to GET after a HTTP 308 redirect 2023-05-19 23:37:20 +02:00
http.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
image.c Merge branch 'PHP-8.0' 2021-07-16 10:07:35 +02:00
incomplete_class.c Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
info.c fix: support for timeouts with ZTS on Linux (#10141) 2023-03-03 11:35:06 +01:00
info.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
iptc.c Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
lcg.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
levenshtein.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
link.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
mail.c Fix GH-10990: mail() throws TypeError after iterating over $additional_headers array by reference 2023-04-01 19:44:43 +02:00
Makefile.frag Revert "Remove some unnecessary explicit header dependencies" 2021-03-16 14:22:25 +01:00
Makefile.frag.w32
math.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
md5.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
md5.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
metaphone.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
microtime.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
mt_rand.c Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
net.c Merge branch 'PHP-8.0' 2021-06-11 09:34:03 +02:00
pack.c Fix undefined behaviour in unpack() 2023-03-28 22:43:27 +02:00
pack.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
pageinfo.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
pageinfo.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
password.c Merge branch 'PHP-8.0' 2021-07-20 15:14:08 +02:00
php_array.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_assert.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_browscap.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_crypt_r.c Merge branch 'PHP-8.0' into PHP-8.1 2022-09-29 20:40:33 +01:00
php_crypt_r.h fix php_init_crypt_r/php_shutdown_crypt_r signatures warning. 2022-09-29 20:40:16 +01:00
php_crypt.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_dir.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_dns.h Merge branch 'PHP-8.0' into PHP-8.1 2021-11-15 10:00:55 +01:00
php_ext_syslog.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_filestat.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_fopen_wrapper.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_fopen_wrappers.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_http.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_image.h AVIF support for getimagesize() and imagecreatefromstring() 2021-07-07 00:02:57 +02:00
php_incomplete_class.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_lcg.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_mail.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_math.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_mt_rand.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_net.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_password.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_rand.h Fix undefined behaviour in GENERATE_SEED() 2023-03-26 16:07:39 +02:00
php_random.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_smart_string_public.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_smart_string.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_standard.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_string.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_uuencode.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_var.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
php_versioning.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
proc_open.c Refactor proc_open() implementation (#7255) 2021-08-11 14:51:55 +02:00
proc_open.h Refactor proc_open() implementation (#7255) 2021-08-11 14:51:55 +02:00
quot_print.c Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
quot_print.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
rand.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
random.c Merge branch 'PHP-8.0' into PHP-8.1 2022-07-15 12:48:09 +01:00
scanf.c Specify function pointer signature for scanf implementation 2021-05-12 18:58:44 +01:00
scanf.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
sha1.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
sha1.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
soundex.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
streamsfuncs.c Fix GH-11175 and GH-11177: Stream socket timeout undefined behaviour 2023-05-03 19:40:52 +02:00
streamsfuncs.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
string.c Fix undefined behaviour in string uppercasing and lowercasing 2023-03-25 21:17:15 +01:00
strnatcmp.c Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
syslog.c Merge branch 'PHP-8.0' into PHP-8.1 2022-06-19 20:09:37 +01:00
type.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
uniqid.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
url_scanner_ex.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
url_scanner_ex.re Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
url.c Fix typos (#7327) 2021-08-01 18:03:30 +01:00
url.h Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
user_filters_arginfo.h Declare php_user_filter::$stream property 2021-08-20 14:50:25 +02:00
user_filters.c Merge branch 'PHP-8.0' into PHP-8.1 2021-10-07 11:46:49 +02:00
user_filters.stub.php Declare php_user_filter::$stream property 2021-08-20 14:50:25 +02:00
uuencode.c Update http->https in license (#6945) 2021-05-06 12:16:35 +02:00
var_unserializer.re Fix bug #81142 by adding zend_string_init_existing_interned() 2021-08-12 11:57:50 +02:00
var.c Fix serialization of RC1 objects appearing in object graph twice 2023-06-28 21:15:03 +02:00
versioning.c Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
winver.h