[php-src] master: Merge branch 'PHP-8.6'
| From: | Tim Düsterhus | Date: | Tue, 22 Sep 2026 17:02:42 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141448@lists.php.net to get a copy of this message | ||
Author: Tim Düsterhus (TimWolla)
Date: 2026-09-22T19:02:34+02:00
Commit: https://github.com/php/php-src/commit/5e0fa49e2f4dff458d3c28aaad0c4ffd40ba1151
Raw diff: https://github.com/php/php-src/commit/5e0fa49e2f4dff458d3c28aaad0c4ffd40ba1151.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
standard: Pass
unserialize('') through the regular path (#23827)
Changed paths:
A ext/standard/tests/serialize/gh23780.phpt
M ext/opcache/tests/jit/assign_048.phpt
M ext/standard/var.c
Diff:
diff --git a/ext/opcache/tests/jit/assign_048.phpt b/ext/opcache/tests/jit/assign_048.phpt
index ed7a058d862b..bce0fdbe67f8 100644
--- a/ext/opcache/tests/jit/assign_048.phpt
+++ b/ext/opcache/tests/jit/assign_048.phpt
@@ -20,23 +20,43 @@ test();
?>
DONE
--EXPECTF--
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+
Warning: Undefined variable $a in %sassign_048.php on line 7
DONE
diff --git a/ext/standard/tests/serialize/gh23780.phpt b/ext/standard/tests/serialize/gh23780.phpt
new file mode 100644
index 000000000000..daaf3029f215
--- /dev/null
+++ b/ext/standard/tests/serialize/gh23780.phpt
@@ -0,0 +1,9 @@
+--TEST--
+GH-23780: unserialize('') fails silently
+--FILE--
+<?php
+var_dump(unserialize(''));
+?>
+--EXPECTF--
+Warning: unserialize(): Error at offset 0 of 0 bytes in %s on line %d
+bool(false)
diff --git a/ext/standard/var.c b/ext/standard/var.c
index f94c1cf09584..7b868afddd27 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -1411,10 +1411,6 @@ PHPAPI void php_unserialize_with_options(zval *return_value, const char *buf,
co
HashTable *class_hash = NULL, *prev_class_hash;
zend_long prev_max_depth, prev_cur_depth;
- if (buf_len == 0) {
- RETURN_FALSE;
- }
-
p = (const unsigned char*) buf;
PHP_VAR_UNSERIALIZE_INIT(var_hash);