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.
}
if (buf_len == 0) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Empty serialized string cannot be empty");
return;
}
}
if (buf_len == 0) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Serialized string cannot be empty");
return;
}
}
if (buf_len == 0) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Empty serialized string cannot be empty");
return;
}
--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/
$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
--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--
}
?>
+Done
--EXPECTF--
-Empty serialized string cannot be empty
-
+Done