Skip to content

Commit dd8de1e

Browse files
authored
Promote unserialize() notices to warning (#9629)
* Unserialize: Migrate "Unexpected end of serialized data" to E_WARNING * Unserialize: Migrate "Error at offset %d of %d bytes" to E_WARNING * Unserialize: Migrate "%s is returned from __sleep() multiple times" to E_WARNING * Add NEWS for “Promote unserialize() notices to warning”
1 parent d0d8344 commit dd8de1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+93
-86
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ PHP NEWS
6161
. Added SKF_AD_QUEUE for cbpf filters. (David Carlier)
6262
. Added socket_atmark if send/recv needs using MSG_OOB. (David Carlier)
6363

64+
- Standard:
65+
. E_NOTICEs emitted by unserialized() have been promoted to E_WARNING. (timwolla)
66+
6467
- Streams:
6568
. Fixed bug #51056: blocking fread() will block even if data is available.
6669
(Jakub Zelenka)

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ PHP 8.3 UPGRADE NOTES
4747
"buffer_size" => int
4848
See GH-9336
4949

50+
- Standard:
51+
. E_NOTICEs emitted by unserialized() have been promoted to E_WARNING.
52+
RFC: https://wiki.php.net/rfc/improve_unserialize_error_handling
53+
5054
========================================
5155
6. New Functions
5256
========================================

Zend/tests/bug70253.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Bug #70253 (segfault at _efree () in zend_alloc.c:1389)
55
unserialize('a:2:{i:0;O:9:"000000000":10000000');
66
?>
77
--EXPECTF--
8-
Notice: unserialize(): Error at offset 33 of 33 bytes in %s on line %d
8+
Warning: unserialize(): Error at offset 33 of 33 bytes in %s on line %d

Zend/tests/enum/unserialize-const.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ var_dump(unserialize('E:7:"Foo:Baz";'));
1414
--EXPECTF--
1515
Warning: unserialize(): Foo::Baz is not an enum case in %s on line %d
1616

17-
Notice: unserialize(): Error at offset 14 of 14 bytes in %s on line %d
17+
Warning: unserialize(): Error at offset 14 of 14 bytes in %s on line %d
1818
bool(false)

Zend/tests/enum/unserialize-missing-colon.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ var_dump(unserialize('E:6:"FooBar";'));
1313
--EXPECTF--
1414
Warning: unserialize(): Invalid enum name 'FooBar' (missing colon) in %s on line %d
1515

16-
Notice: unserialize(): Error at offset 0 of 13 bytes in %s on line %d
16+
Warning: unserialize(): Error at offset 0 of 13 bytes in %s on line %d
1717
bool(false)

Zend/tests/enum/unserialize-non-enum.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ var_dump(unserialize('E:7:"Foo:Bar";'));
1111
--EXPECTF--
1212
Warning: unserialize(): Class 'Foo' is not an enum in %s on line %d
1313

14-
Notice: unserialize(): Error at offset 0 of 14 bytes in %s on line %d
14+
Warning: unserialize(): Error at offset 0 of 14 bytes in %s on line %d
1515
bool(false)

Zend/tests/enum/unserialize-non-existent-case.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ var_dump(unserialize('E:7:"Foo:Baz";'));
1313
--EXPECTF--
1414
Warning: unserialize(): Undefined constant Foo::Baz in %s on line %d
1515

16-
Notice: unserialize(): Error at offset 14 of 14 bytes in %s on line %d
16+
Warning: unserialize(): Error at offset 14 of 14 bytes in %s on line %d
1717
bool(false)

ext/gmp/tests/bug74670.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ $str = 'C:3:"GMP":4:{s:6666666666:""}';
88
var_dump(unserialize($str));
99
?>
1010
--EXPECTF--
11-
Notice: unserialize(): Error at offset 13 of 29 bytes in %s on line %d
11+
Warning: unserialize(): Error at offset 13 of 29 bytes in %s on line %d
1212
bool(false)

ext/phar/tests/phar_metadata_write3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Calling getMetadata with too low max_depth
7979

8080
Warning: Phar::getMetadata(): Maximum depth of 1 exceeded. The depth limit can be changed using the max_depth unserialize() option or the unserialize_max_depth ini setting in %sphar_metadata_write3.php on line 39
8181

82-
Notice: Phar::getMetadata(): Error at offset 34 of 59 bytes in %sphar_metadata_write3.php on line 39
82+
Warning: Phar::getMetadata(): Error at offset 34 of 59 bytes in %sphar_metadata_write3.php on line 39
8383
bool(false)
8484
Calling getMetadata with some allowed classes
8585
In wakeup

ext/session/tests/bug72562.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function ptr2str($ptr)
4040
--EXPECTF--
4141
Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s%ebug72562.php on line %d
4242

43-
Notice: unserialize(): Error at offset 0 of 1 bytes in %s%ebug72562.php on line %d
43+
Warning: unserialize(): Error at offset 0 of 1 bytes in %s on line %d
4444

45-
Notice: unserialize(): Error at offset 4 of 4 bytes in %s%ebug72562.php on line %d
45+
Warning: unserialize(): Error at offset 4 of 4 bytes in %s on line %d
4646
bool(false)

0 commit comments

Comments
 (0)