mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fixed confused exception message while user threw exception
This commit is contained in:
parent
f52b2e6a65
commit
7197f0ffcc
2 changed files with 25 additions and 1 deletions
24
Zend/tests/bug64354.phpt
Normal file
24
Zend/tests/bug64354.phpt
Normal file
|
@ -0,0 +1,24 @@
|
|||
--TEST--
|
||||
Bug #64354 (Unserialize array of objects whose class can't be autoloaded fail)
|
||||
--FILE--
|
||||
<?php
|
||||
class B implements Serializable {
|
||||
public function serialize() {
|
||||
throw new Exception("serialize");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public function unserialize($data) {
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(new B);
|
||||
|
||||
try {
|
||||
serialize($data);
|
||||
} catch (Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(9) "serialize"
|
|
@ -452,7 +452,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, zend_uint
|
|||
zval_ptr_dtor(&retval);
|
||||
}
|
||||
|
||||
if (result == FAILURE) {
|
||||
if (result == FAILURE && !EG(exception)) {
|
||||
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "%s::serialize() must return a string or NULL", ce->name);
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue