@@ -2267,7 +2267,7 @@ static zval *row_read_column_number(pdo_stmt_t *stmt, zend_long column, zval *rv
2267
2267
2268
2268
static zval * row_prop_read (zend_object * object , zend_string * name , int type , void * * cache_slot , zval * rv )
2269
2269
{
2270
- pdo_row_t * row = ( pdo_row_t * ) object ;
2270
+ pdo_row_t * row = php_pdo_row_fetch_object ( object ) ;
2271
2271
pdo_stmt_t * stmt = row -> stmt ;
2272
2272
zend_long lval ;
2273
2273
zval * retval ;
@@ -2304,7 +2304,7 @@ static zval *row_dim_read(zend_object *object, zval *offset, int type, zval *rv)
2304
2304
return NULL ;
2305
2305
}
2306
2306
if (Z_TYPE_P (offset ) == IS_LONG ) {
2307
- pdo_row_t * row = ( pdo_row_t * ) object ;
2307
+ pdo_row_t * row = php_pdo_row_fetch_object ( object ) ;
2308
2308
pdo_stmt_t * stmt = row -> stmt ;
2309
2309
ZEND_ASSERT (stmt );
2310
2310
@@ -2342,7 +2342,7 @@ static void row_dim_write(zend_object *object, zval *member, zval *value)
2342
2342
// todo: make row_prop_exists return bool as well
2343
2343
static int row_prop_exists (zend_object * object , zend_string * name , int check_empty , void * * cache_slot )
2344
2344
{
2345
- pdo_row_t * row = ( pdo_row_t * ) object ;
2345
+ pdo_row_t * row = php_pdo_row_fetch_object ( object ) ;
2346
2346
pdo_stmt_t * stmt = row -> stmt ;
2347
2347
zend_long lval ;
2348
2348
zval tmp_val ;
@@ -2370,7 +2370,7 @@ static int row_prop_exists(zend_object *object, zend_string *name, int check_emp
2370
2370
static int row_dim_exists (zend_object * object , zval * offset , int check_empty )
2371
2371
{
2372
2372
if (Z_TYPE_P (offset ) == IS_LONG ) {
2373
- pdo_row_t * row = ( pdo_row_t * ) object ;
2373
+ pdo_row_t * row = php_pdo_row_fetch_object ( object ) ;
2374
2374
pdo_stmt_t * stmt = row -> stmt ;
2375
2375
ZEND_ASSERT (stmt );
2376
2376
zend_long column = Z_LVAL_P (offset );
@@ -2411,7 +2411,7 @@ static void row_dim_delete(zend_object *object, zval *offset)
2411
2411
2412
2412
static HashTable * row_get_properties_for (zend_object * object , zend_prop_purpose purpose )
2413
2413
{
2414
- pdo_row_t * row = ( pdo_row_t * ) object ;
2414
+ pdo_row_t * row = php_pdo_row_fetch_object ( object ) ;
2415
2415
pdo_stmt_t * stmt = row -> stmt ;
2416
2416
HashTable * props ;
2417
2417
int i ;
@@ -2453,7 +2453,7 @@ static zval *pdo_row_get_property_ptr_ptr(zend_object *object, zend_string *name
2453
2453
2454
2454
void pdo_row_free_storage (zend_object * std )
2455
2455
{
2456
- pdo_row_t * row = ( pdo_row_t * ) std ;
2456
+ pdo_row_t * row = php_pdo_row_fetch_object ( std ) ;
2457
2457
if (row -> stmt ) {
2458
2458
ZVAL_UNDEF (& row -> stmt -> lazy_object_ref );
2459
2459
OBJ_RELEASE (& row -> stmt -> std );
@@ -2490,6 +2490,7 @@ void pdo_stmt_init(void)
2490
2490
pdo_row_ce -> default_object_handlers = & pdo_row_object_handlers ;
2491
2491
2492
2492
memcpy (& pdo_row_object_handlers , & std_object_handlers , sizeof (zend_object_handlers ));
2493
+ pdo_row_object_handlers .offset = XtOffsetOf (pdo_row_t , std );
2493
2494
pdo_row_object_handlers .free_obj = pdo_row_free_storage ;
2494
2495
pdo_row_object_handlers .clone_obj = NULL ;
2495
2496
pdo_row_object_handlers .get_property_ptr_ptr = pdo_row_get_property_ptr_ptr ;
0 commit comments