mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Add cast_object handler for objects which were recently converted from resources
This commit is contained in:
@@ -186,6 +186,17 @@ static zend_function *odbc_connection_get_constructor(zend_object *object)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static zend_result odbc_connection_cast_object(zend_object *obj, zval *result, int type)
|
||||
{
|
||||
if (type == IS_LONG) {
|
||||
ZVAL_LONG(result, obj->handle);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
return zend_std_cast_object_tostring(obj, result, type);
|
||||
}
|
||||
|
||||
static void odbc_connection_free_obj(zend_object *obj)
|
||||
{
|
||||
odbc_link *link = odbc_link_from_obj(obj);
|
||||
@@ -218,6 +229,17 @@ static zend_function *odbc_result_get_constructor(zend_object *object)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static zend_result odbc_result_cast_object(zend_object *obj, zval *result, int type)
|
||||
{
|
||||
if (type == IS_LONG) {
|
||||
ZVAL_LONG(result, obj->handle);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
return zend_std_cast_object_tostring(obj, result, type);
|
||||
}
|
||||
|
||||
static void odbc_result_free(odbc_result *res)
|
||||
{
|
||||
ZEND_ASSERT(res->conn_ptr && "result has already been closed");
|
||||
@@ -534,6 +556,7 @@ PHP_MINIT_FUNCTION(odbc)
|
||||
odbc_connection_object_handlers.free_obj = odbc_connection_free_obj;
|
||||
odbc_connection_object_handlers.get_constructor = odbc_connection_get_constructor;
|
||||
odbc_connection_object_handlers.clone_obj = NULL;
|
||||
odbc_connection_object_handlers.cast_object = odbc_connection_cast_object;
|
||||
odbc_connection_object_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
odbc_result_ce = register_class_Odbc_Result();
|
||||
@@ -545,6 +568,7 @@ PHP_MINIT_FUNCTION(odbc)
|
||||
odbc_result_object_handlers.free_obj = odbc_result_free_obj;
|
||||
odbc_result_object_handlers.get_constructor = odbc_result_get_constructor;
|
||||
odbc_result_object_handlers.clone_obj = NULL;
|
||||
odbc_result_object_handlers.cast_object = odbc_result_cast_object;
|
||||
odbc_result_object_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
#if defined(HAVE_IBMDB2) && defined(_AIX)
|
||||
|
||||
@@ -228,6 +228,17 @@ static zend_function *soap_url_object_get_constructor(zend_object *object)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static zend_result soap_url_cast_object(zend_object *obj, zval *result, int type)
|
||||
{
|
||||
if (type == IS_LONG) {
|
||||
ZVAL_LONG(result, obj->handle);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
return zend_std_cast_object_tostring(obj, result, type);
|
||||
}
|
||||
|
||||
static inline soap_sdl_object *soap_sdl_object_fetch(zend_object *obj)
|
||||
{
|
||||
return (soap_sdl_object *) ((char *) obj - XtOffsetOf(soap_sdl_object, std));
|
||||
@@ -264,6 +275,17 @@ static zend_function *soap_sdl_object_get_constructor(zend_object *object)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static zend_result soap_sdl_cast_object(zend_object *obj, zval *result, int type)
|
||||
{
|
||||
if (type == IS_LONG) {
|
||||
ZVAL_LONG(result, obj->handle);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
return zend_std_cast_object_tostring(obj, result, type);
|
||||
}
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(soap)
|
||||
|
||||
static void (*old_error_handler)(int, zend_string *, const uint32_t, zend_string *);
|
||||
@@ -487,6 +509,7 @@ PHP_MINIT_FUNCTION(soap)
|
||||
soap_url_object_handlers.free_obj = soap_url_object_free;
|
||||
soap_url_object_handlers.get_constructor = soap_url_object_get_constructor;
|
||||
soap_url_object_handlers.clone_obj = NULL;
|
||||
soap_url_object_handlers.cast_object = soap_url_cast_object;
|
||||
soap_url_object_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
soap_sdl_class_entry = register_class_Soap_Sdl();
|
||||
@@ -498,6 +521,7 @@ PHP_MINIT_FUNCTION(soap)
|
||||
soap_sdl_object_handlers.free_obj = soap_sdl_object_free;
|
||||
soap_sdl_object_handlers.get_constructor = soap_sdl_object_get_constructor;
|
||||
soap_sdl_object_handlers.clone_obj = NULL;
|
||||
soap_url_object_handlers.cast_object = soap_sdl_cast_object;
|
||||
soap_sdl_object_handlers.compare = zend_objects_not_comparable;
|
||||
|
||||
register_soap_symbols(module_number);
|
||||
|
||||
Reference in New Issue
Block a user