Browse Source

Merge branch 'PHP-5.6'

* PHP-5.6:
  NEWS
  Fix Request #67453 Allow to unserialize empty data.
pull/697/head
Remi Collet 12 years ago
parent
commit
a012c2befa
  1. 1
      ext/spl/spl_array.c
  2. 1
      ext/spl/spl_dllist.c
  3. 1
      ext/spl/spl_observer.c
  4. 9
      ext/spl/tests/ArrayObject_unserialize_empty_string.phpt
  5. 6
      ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt

1
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;
}

1
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;
}

1
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;
}

9
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

6
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
Loading…
Cancel
Save