mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions And convert some object to string conversion related recoverable fatal errors into Error exceptions. Improve exception safety of internal code performing string conversions.
This commit is contained in:
parent
528aa7932a
commit
a31f46421d
113 changed files with 1402 additions and 486 deletions
|
@ -522,7 +522,9 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
|
|||
}
|
||||
break;
|
||||
case xmlrpc_datetime:
|
||||
convert_to_string(&val);
|
||||
if (!try_convert_to_string(&val)) {
|
||||
return NULL;
|
||||
}
|
||||
xReturn = XMLRPC_CreateValueDateTime_ISO8601(key, Z_STRVAL(val));
|
||||
break;
|
||||
case xmlrpc_boolean:
|
||||
|
@ -538,7 +540,9 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
|
|||
xReturn = XMLRPC_CreateValueDouble(key, Z_DVAL(val));
|
||||
break;
|
||||
case xmlrpc_string:
|
||||
convert_to_string(&val);
|
||||
if (!try_convert_to_string(&val)) {
|
||||
return NULL;
|
||||
}
|
||||
xReturn = XMLRPC_CreateValueString(key, Z_STRVAL(val), Z_STRLEN(val));
|
||||
break;
|
||||
case xmlrpc_vector:
|
||||
|
@ -925,7 +929,10 @@ static void php_xmlrpc_introspection_callback(XMLRPC_SERVER server, void* data)
|
|||
STRUCT_XMLRPC_ERROR err = {0};
|
||||
|
||||
/* return value should be a string */
|
||||
convert_to_string(&retval);
|
||||
if (!try_convert_to_string(&retval)) {
|
||||
zend_string_release_ex(php_function_name, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
xData = XMLRPC_IntrospectionCreateDescription(Z_STRVAL(retval), &err);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue