com php-src: Fix Request #67453 Allow to unserialize empty data.: ext/spl/spl_array.c ext/spl/spl_dllist.c ext/spl/sp l_observer.c
ext/spl/tests/ArrayObject_unserialize_em pty_string.phpt ext/spl/tests/SplObjectStorage_unserial ize_invalid_parameter3.phpt
| From: | Remi Collet | Date: | Tue, 17 Jun 2014 07:38:54 +0000 |
| Subject: | com php-src: Fix Request #67453 Allow to unserialize empty data.: ext/spl/spl_array.c ext/spl/spl_dllist.c ext/spl/sp l_observer.c ext/spl/tests/ArrayObject_unserialize_em pty_string.phpt ext/spl/tests/SplObjectStorage_unserial ize_invalid_parameter3.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78930@lists.php.net to get a copy of this message | ||
Commit: ea466a316ffc39c7d5733c5aa1c37ab604af6e57
Author: Remi Collet <remi@php.net> Tue, 17 Jun 2014 09:38:54 +0200
Parents: b538816b0bff9f974223be1b39e4cbdd9cda8adc
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ea466a316ffc39c7d5733c5aa1c37ab604af6e57
Log:
Fix Request #67453 Allow to unserialize empty data.
SplDoublyLinkedList, SplObjectStorage and ArrayObject have empty
constructor (no arg), so it make sense to allow to unserialize empty
data.
This allow the hack (used in various place, including PHPUnit) to
instanciate class without call to constructor to work.
Bugs:
https://bugs.php.net/67453
Changed paths:
M ext/spl/spl_array.c
M ext/spl/spl_dllist.c
M ext/spl/spl_observer.c
M ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
M ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt
Diff:
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 9e3848d..4191b0d 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -1749,7 +1749,6 @@ SPL_METHOD(Array, unserialize)
}
if (buf_len == 0) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Empty serialized
string cannot be empty");
return;
}
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 772d780..fb88f58 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -1192,7 +1192,6 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
}
if (buf_len == 0) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Serialized string
cannot be empty");
return;
}
diff --git a/ext/spl/spl_observer..c b/ext/spl/spl_observer.c
index 91830ab..57ddf49 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -831,7 +831,6 @@ SPL_METHOD(SplObjectStorage, unserialize)
}
if (buf_len == 0) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Empty serialized
string cannot be empty");
return;
}
diff --git a/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
b/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
index 75d8a41...4c446c8 100644
--- a/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
+++ b/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
@@ -1,5 +1,5 @@
--TEST--
-ArrayObject: test that you cannot unserialize a empty string
+ArrayObject: test that you can unserialize a empty string
--CREDITS--
Havard Eide <nucleuz@gmail.com>
#PHPTestFest2009 Norway 2009-06-09 \o/
@@ -8,9 +8,6 @@ Havard Eide <nucleuz@gmail.com>
$a = new ArrayObject(array());
$a->unserialize("");
?>
+Done
--EXPECTF--
-Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty
serialized string cannot be empty' in %s.php:%d
-Stack trace:
-#0 %s(%d): ArrayObject->unserialize('')
-#1 {main}
- thrown in %s.php on line %d
+Done
diff --git a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt
b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt
index 4c2dd75..617f85e 100644
--- a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt
+++ b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt
@@ -1,5 +1,5 @@
--TEST--
-Check that SplObjectStorage::unserialize throws exception when NULL passed
+Check that SplObjectStorage::unserialize doesn't throws exception when NULL passed
--CREDITS--
PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
--FILE--
@@ -14,6 +14,6 @@ try {
}
?>
+Done
--EXPECTF--
-Empty serialized string cannot be empty
-
+Done