@@ -2259,26 +2259,25 @@ static zval *row_prop_read(zend_object *object, zend_string *name, int type, voi
2259
2259
pdo_stmt_t * stmt = row -> stmt ;
2260
2260
int colno = -1 ;
2261
2261
zend_long lval ;
2262
+ ZEND_ASSERT (stmt );
2262
2263
2263
2264
ZVAL_NULL (rv );
2264
- if (stmt ) {
2265
- if (is_numeric_string (ZSTR_VAL (name ), ZSTR_LEN (name ), & lval , NULL , 0 ) == IS_LONG ) {
2266
- if (lval >= 0 && lval < stmt -> column_count ) {
2267
- fetch_value (stmt , rv , lval , NULL );
2268
- }
2269
- } else {
2270
- /* TODO: replace this with a hash of available column names to column
2271
- * numbers */
2272
- for (colno = 0 ; colno < stmt -> column_count ; colno ++ ) {
2273
- if (zend_string_equals (stmt -> columns [colno ].name , name )) {
2274
- fetch_value (stmt , rv , colno , NULL );
2275
- return rv ;
2276
- }
2277
- }
2278
- if (zend_string_equals_literal (name , "queryString" )) {
2279
- return zend_std_read_property (& stmt -> std , name , type , cache_slot , rv );
2265
+ if (is_numeric_string (ZSTR_VAL (name ), ZSTR_LEN (name ), & lval , NULL , 0 ) == IS_LONG ) {
2266
+ if (lval >= 0 && lval < stmt -> column_count ) {
2267
+ fetch_value (stmt , rv , lval , NULL );
2268
+ }
2269
+ } else {
2270
+ /* TODO: replace this with a hash of available column names to column
2271
+ * numbers */
2272
+ for (colno = 0 ; colno < stmt -> column_count ; colno ++ ) {
2273
+ if (zend_string_equals (stmt -> columns [colno ].name , name )) {
2274
+ fetch_value (stmt , rv , colno , NULL );
2275
+ return rv ;
2280
2276
}
2281
2277
}
2278
+ if (zend_string_equals_literal (name , "queryString" )) {
2279
+ return zend_std_read_property (& stmt -> std , name , type , cache_slot , rv );
2280
+ }
2282
2281
}
2283
2282
2284
2283
return rv ;
@@ -2290,35 +2289,34 @@ static zval *row_dim_read(zend_object *object, zval *member, int type, zval *rv)
2290
2289
pdo_stmt_t * stmt = row -> stmt ;
2291
2290
int colno = -1 ;
2292
2291
zend_long lval ;
2292
+ ZEND_ASSERT (stmt );
2293
2293
2294
2294
ZVAL_NULL (rv );
2295
- if (stmt ) {
2296
- if (Z_TYPE_P (member ) == IS_LONG ) {
2297
- if (Z_LVAL_P (member ) >= 0 && Z_LVAL_P (member ) < stmt -> column_count ) {
2298
- fetch_value (stmt , rv , Z_LVAL_P (member ), NULL );
2299
- }
2300
- } else if (Z_TYPE_P (member ) == IS_STRING
2301
- && is_numeric_string (Z_STRVAL_P (member ), Z_STRLEN_P (member ), & lval , NULL , 0 ) == IS_LONG ) {
2302
- if (lval >= 0 && lval < stmt -> column_count ) {
2303
- fetch_value (stmt , rv , lval , NULL );
2304
- }
2305
- } else {
2306
- if (!try_convert_to_string (member )) {
2307
- return & EG (uninitialized_zval );
2308
- }
2295
+ if (Z_TYPE_P (member ) == IS_LONG ) {
2296
+ if (Z_LVAL_P (member ) >= 0 && Z_LVAL_P (member ) < stmt -> column_count ) {
2297
+ fetch_value (stmt , rv , Z_LVAL_P (member ), NULL );
2298
+ }
2299
+ } else if (Z_TYPE_P (member ) == IS_STRING
2300
+ && is_numeric_string (Z_STRVAL_P (member ), Z_STRLEN_P (member ), & lval , NULL , 0 ) == IS_LONG ) {
2301
+ if (lval >= 0 && lval < stmt -> column_count ) {
2302
+ fetch_value (stmt , rv , lval , NULL );
2303
+ }
2304
+ } else {
2305
+ if (!try_convert_to_string (member )) {
2306
+ return & EG (uninitialized_zval );
2307
+ }
2309
2308
2310
- /* TODO: replace this with a hash of available column names to column
2311
- * numbers */
2312
- for (colno = 0 ; colno < stmt -> column_count ; colno ++ ) {
2313
- if (zend_string_equals (stmt -> columns [colno ].name , Z_STR_P (member ))) {
2314
- fetch_value (stmt , rv , colno , NULL );
2315
- return rv ;
2316
- }
2317
- }
2318
- if (zend_string_equals_literal (Z_STR_P (member ), "queryString" )) {
2319
- return zend_std_read_property (& stmt -> std , Z_STR_P (member ), type , NULL , rv );
2309
+ /* TODO: replace this with a hash of available column names to column
2310
+ * numbers */
2311
+ for (colno = 0 ; colno < stmt -> column_count ; colno ++ ) {
2312
+ if (zend_string_equals (stmt -> columns [colno ].name , Z_STR_P (member ))) {
2313
+ fetch_value (stmt , rv , colno , NULL );
2314
+ return rv ;
2320
2315
}
2321
2316
}
2317
+ if (zend_string_equals_literal (Z_STR_P (member ), "queryString" )) {
2318
+ return zend_std_read_property (& stmt -> std , Z_STR_P (member ), type , NULL , rv );
2319
+ }
2322
2320
}
2323
2321
2324
2322
return rv ;
@@ -2341,25 +2339,24 @@ static int row_prop_exists(zend_object *object, zend_string *name, int check_emp
2341
2339
pdo_stmt_t * stmt = row -> stmt ;
2342
2340
int colno = -1 ;
2343
2341
zend_long lval ;
2342
+ ZEND_ASSERT (stmt );
2344
2343
2345
- if (stmt ) {
2346
- if (is_numeric_string (ZSTR_VAL (name ), ZSTR_LEN (name ), & lval , NULL , 0 ) == IS_LONG ) {
2347
- return lval >=0 && lval < stmt -> column_count ;
2348
- }
2344
+ if (is_numeric_string (ZSTR_VAL (name ), ZSTR_LEN (name ), & lval , NULL , 0 ) == IS_LONG ) {
2345
+ return lval >=0 && lval < stmt -> column_count ;
2346
+ }
2349
2347
2350
- /* TODO: replace this with a hash of available column names to column
2351
- * numbers */
2352
- for (colno = 0 ; colno < stmt -> column_count ; colno ++ ) {
2353
- if (zend_string_equals (stmt -> columns [colno ].name , name )) {
2354
- int res ;
2355
- zval val ;
2348
+ /* TODO: replace this with a hash of available column names to column
2349
+ * numbers */
2350
+ for (colno = 0 ; colno < stmt -> column_count ; colno ++ ) {
2351
+ if (zend_string_equals (stmt -> columns [colno ].name , name )) {
2352
+ int res ;
2353
+ zval val ;
2356
2354
2357
- fetch_value (stmt , & val , colno , NULL );
2358
- res = check_empty ? i_zend_is_true (& val ) : Z_TYPE (val ) != IS_NULL ;
2359
- zval_ptr_dtor_nogc (& val );
2355
+ fetch_value (stmt , & val , colno , NULL );
2356
+ res = check_empty ? i_zend_is_true (& val ) : Z_TYPE (val ) != IS_NULL ;
2357
+ zval_ptr_dtor_nogc (& val );
2360
2358
2361
- return res ;
2362
- }
2359
+ return res ;
2363
2360
}
2364
2361
}
2365
2362
@@ -2372,33 +2369,32 @@ static int row_dim_exists(zend_object *object, zval *member, int check_empty)
2372
2369
pdo_stmt_t * stmt = row -> stmt ;
2373
2370
int colno = -1 ;
2374
2371
zend_long lval ;
2372
+ ZEND_ASSERT (stmt );
2375
2373
2376
- if (stmt ) {
2377
- if (Z_TYPE_P (member ) == IS_LONG ) {
2378
- return Z_LVAL_P (member ) >= 0 && Z_LVAL_P (member ) < stmt -> column_count ;
2379
- } else if (Z_TYPE_P (member ) == IS_STRING ) {
2380
- if (is_numeric_string (Z_STRVAL_P (member ), Z_STRLEN_P (member ), & lval , NULL , 0 ) == IS_LONG ) {
2381
- return lval >=0 && lval < stmt -> column_count ;
2382
- }
2383
- } else {
2384
- if (!try_convert_to_string (member )) {
2385
- return 0 ;
2386
- }
2374
+ if (Z_TYPE_P (member ) == IS_LONG ) {
2375
+ return Z_LVAL_P (member ) >= 0 && Z_LVAL_P (member ) < stmt -> column_count ;
2376
+ } else if (Z_TYPE_P (member ) == IS_STRING ) {
2377
+ if (is_numeric_string (Z_STRVAL_P (member ), Z_STRLEN_P (member ), & lval , NULL , 0 ) == IS_LONG ) {
2378
+ return lval >=0 && lval < stmt -> column_count ;
2379
+ }
2380
+ } else {
2381
+ if (!try_convert_to_string (member )) {
2382
+ return 0 ;
2387
2383
}
2384
+ }
2388
2385
2389
- /* TODO: replace this with a hash of available column names to column
2390
- * numbers */
2391
- for (colno = 0 ; colno < stmt -> column_count ; colno ++ ) {
2392
- if (zend_string_equals (stmt -> columns [colno ].name , Z_STR_P (member ))) {
2393
- int res ;
2394
- zval val ;
2386
+ /* TODO: replace this with a hash of available column names to column
2387
+ * numbers */
2388
+ for (colno = 0 ; colno < stmt -> column_count ; colno ++ ) {
2389
+ if (zend_string_equals (stmt -> columns [colno ].name , Z_STR_P (member ))) {
2390
+ int res ;
2391
+ zval val ;
2395
2392
2396
- fetch_value (stmt , & val , colno , NULL );
2397
- res = check_empty ? i_zend_is_true (& val ) : Z_TYPE (val ) != IS_NULL ;
2398
- zval_ptr_dtor_nogc (& val );
2393
+ fetch_value (stmt , & val , colno , NULL );
2394
+ res = check_empty ? i_zend_is_true (& val ) : Z_TYPE (val ) != IS_NULL ;
2395
+ zval_ptr_dtor_nogc (& val );
2399
2396
2400
- return res ;
2401
- }
2397
+ return res ;
2402
2398
}
2403
2399
}
2404
2400
@@ -2421,8 +2417,9 @@ static HashTable *row_get_properties_for(zend_object *object, zend_prop_purpose
2421
2417
pdo_stmt_t * stmt = row -> stmt ;
2422
2418
HashTable * props ;
2423
2419
int i ;
2420
+ ZEND_ASSERT (stmt );
2424
2421
2425
- if (purpose != ZEND_PROP_PURPOSE_DEBUG || stmt == NULL ) {
2422
+ if (purpose != ZEND_PROP_PURPOSE_DEBUG ) {
2426
2423
return zend_std_get_properties_for (object , purpose );
2427
2424
}
2428
2425
0 commit comments