@@ -2321,28 +2321,28 @@ PHP_FUNCTION(pg_lo_create)
2321
2321
2322
2322
if (oid ) {
2323
2323
switch (Z_TYPE_P (oid )) {
2324
- case IS_STRING :
2325
- {
2326
- /* TODO: Use zend_is_numeric_string/subroutine? */
2327
- char * end_ptr ;
2328
- wanted_oid = (Oid )strtoul (Z_STRVAL_P (oid ), & end_ptr , 10 );
2329
- if ((Z_STRVAL_P (oid )+ Z_STRLEN_P (oid )) != end_ptr ) {
2330
- /* wrong integer format */
2331
- zend_value_error ("Invalid OID value passed" );
2332
- RETURN_THROWS ();
2324
+ case IS_STRING :
2325
+ {
2326
+ /* TODO: Use subroutine? */
2327
+ char * end_ptr ;
2328
+ wanted_oid = (Oid )strtoul (Z_STRVAL_P (oid ), & end_ptr , 10 );
2329
+ if ((Z_STRVAL_P (oid )+ Z_STRLEN_P (oid )) != end_ptr ) {
2330
+ /* wrong integer format */
2331
+ zend_value_error ("Invalid OID value passed" );
2332
+ RETURN_THROWS ();
2333
+ }
2333
2334
}
2334
- }
2335
- break ;
2336
- case IS_LONG :
2337
- if (Z_LVAL_P (oid ) < (zend_long )InvalidOid ) {
2338
- zend_value_error ("Invalid OID value passed" );
2335
+ break ;
2336
+ case IS_LONG :
2337
+ if (Z_LVAL_P (oid ) < (zend_long )InvalidOid ) {
2338
+ zend_value_error ("Invalid OID value passed" );
2339
+ RETURN_THROWS ();
2340
+ }
2341
+ wanted_oid = (Oid )Z_LVAL_P (oid );
2342
+ break ;
2343
+ default :
2344
+ zend_type_error ("OID value must be of type string|int, %s given" , zend_zval_type_name (oid ));
2339
2345
RETURN_THROWS ();
2340
- }
2341
- wanted_oid = (Oid )Z_LVAL_P (oid );
2342
- break ;
2343
- default :
2344
- zend_type_error ("OID value must be of type string|int, %s given" , zend_zval_type_name (oid ));
2345
- RETURN_THROWS ();
2346
2346
}
2347
2347
if ((pgsql_oid = lo_create (pgsql , wanted_oid )) == InvalidOid ) {
2348
2348
php_error_docref (NULL , E_WARNING , "Unable to create PostgreSQL large object" );
@@ -2376,7 +2376,7 @@ PHP_FUNCTION(pg_lo_unlink)
2376
2376
/* accept string type since Oid type is unsigned int */
2377
2377
if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , argc ,
2378
2378
"rs" , & pgsql_link , & oid_string , & oid_strlen ) == SUCCESS ) {
2379
- /* TODO: Use zend_is_numeric_string/ subroutine? */
2379
+ /* TODO: Use subroutine? */
2380
2380
oid = (Oid )strtoul (oid_string , & end_ptr , 10 );
2381
2381
if ((oid_string + oid_strlen ) != end_ptr ) {
2382
2382
/* wrong integer format */
@@ -2396,7 +2396,7 @@ PHP_FUNCTION(pg_lo_unlink)
2396
2396
}
2397
2397
else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , argc ,
2398
2398
"s" , & oid_string , & oid_strlen ) == SUCCESS ) {
2399
- /* TODO: Use zend_is_numeric_string/ subroutine? */
2399
+ /* TODO: subroutine? */
2400
2400
oid = (Oid )strtoul (oid_string , & end_ptr , 10 );
2401
2401
if ((oid_string + oid_strlen ) != end_ptr ) {
2402
2402
/* wrong integer format */
@@ -2451,7 +2451,7 @@ PHP_FUNCTION(pg_lo_open)
2451
2451
/* accept string type since Oid is unsigned int */
2452
2452
if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , argc ,
2453
2453
"rss" , & pgsql_link , & oid_string , & oid_strlen , & mode_string , & mode_strlen ) == SUCCESS ) {
2454
- /* TODO: Use zend_is_numeric_string/ subroutine? */
2454
+ /* TODO: Use subroutine? */
2455
2455
oid = (Oid )strtoul (oid_string , & end_ptr , 10 );
2456
2456
if ((oid_string + oid_strlen ) != end_ptr ) {
2457
2457
/* wrong integer format */
@@ -2471,7 +2471,7 @@ PHP_FUNCTION(pg_lo_open)
2471
2471
}
2472
2472
else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , argc ,
2473
2473
"ss" , & oid_string , & oid_strlen , & mode_string , & mode_strlen ) == SUCCESS ) {
2474
- /* TODO: Use zend_is_numeric_string/ subroutine? */
2474
+ /* TODO: Use subroutine? */
2475
2475
oid = (Oid )strtoul (oid_string , & end_ptr , 10 );
2476
2476
if ((oid_string + oid_strlen ) != end_ptr ) {
2477
2477
/* wrong integer format */
@@ -2531,7 +2531,6 @@ PHP_FUNCTION(pg_lo_open)
2531
2531
if ((pgsql_lofd = lo_open (pgsql , oid , pgsql_mode )) == -1 ) {
2532
2532
if (lo_unlink (pgsql , oid ) == -1 ) {
2533
2533
efree (pgsql_lofp );
2534
- /* TODO: Throw error? */
2535
2534
php_error_docref (NULL , E_WARNING , "Something is really messed up! Your database is badly corrupted in a way NOT related to PHP" );
2536
2535
RETURN_FALSE ;
2537
2536
}
@@ -2722,28 +2721,28 @@ PHP_FUNCTION(pg_lo_import)
2722
2721
if (oid ) {
2723
2722
Oid wanted_oid ;
2724
2723
switch (Z_TYPE_P (oid )) {
2725
- case IS_STRING :
2726
- {
2727
- /* TODO: Use zend_is_numeric_string/subroutine? */
2728
- char * end_ptr ;
2729
- wanted_oid = (Oid )strtoul (Z_STRVAL_P (oid ), & end_ptr , 10 );
2730
- if ((Z_STRVAL_P (oid )+ Z_STRLEN_P (oid )) != end_ptr ) {
2731
- /* wrong integer format */
2732
- zend_value_error ("Invalid OID value passed" );
2733
- RETURN_THROWS ();
2724
+ case IS_STRING :
2725
+ {
2726
+ /* TODO: Use subroutine? */
2727
+ char * end_ptr ;
2728
+ wanted_oid = (Oid )strtoul (Z_STRVAL_P (oid ), & end_ptr , 10 );
2729
+ if ((Z_STRVAL_P (oid )+ Z_STRLEN_P (oid )) != end_ptr ) {
2730
+ /* wrong integer format */
2731
+ zend_value_error ("Invalid OID value passed" );
2732
+ RETURN_THROWS ();
2733
+ }
2734
2734
}
2735
- }
2736
- break ;
2737
- case IS_LONG :
2738
- if (Z_LVAL_P (oid ) < (zend_long )InvalidOid ) {
2739
- zend_value_error ("Invalid OID value passed" );
2735
+ break ;
2736
+ case IS_LONG :
2737
+ if (Z_LVAL_P (oid ) < (zend_long )InvalidOid ) {
2738
+ zend_value_error ("Invalid OID value passed" );
2739
+ RETURN_THROWS ();
2740
+ }
2741
+ wanted_oid = (Oid )Z_LVAL_P (oid );
2742
+ break ;
2743
+ default :
2744
+ zend_type_error ("OID value must be of type string|int, %s given" , zend_zval_type_name (oid ));
2740
2745
RETURN_THROWS ();
2741
- }
2742
- wanted_oid = (Oid )Z_LVAL_P (oid );
2743
- break ;
2744
- default :
2745
- zend_type_error ("OID value must be of type string|int, %s given" , zend_zval_type_name (oid ));
2746
- RETURN_THROWS ();
2747
2746
}
2748
2747
2749
2748
returned_oid = lo_import_with_oid (pgsql , file_in , wanted_oid );
@@ -2789,7 +2788,7 @@ PHP_FUNCTION(pg_lo_export)
2789
2788
}
2790
2789
else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , argc ,
2791
2790
"rsp" , & pgsql_link , & oid_string , & oid_strlen , & file_out , & name_len ) == SUCCESS ) {
2792
- /* TODO: Use zend_is_numeric_string/ subroutine? */
2791
+ /* TODO: Use subroutine? */
2793
2792
oid = (Oid )strtoul (oid_string , & end_ptr , 10 );
2794
2793
if ((oid_string + oid_strlen ) != end_ptr ) {
2795
2794
/* wrong integer format */
@@ -2810,7 +2809,7 @@ PHP_FUNCTION(pg_lo_export)
2810
2809
}
2811
2810
else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , argc ,
2812
2811
"sp" , & oid_string , & oid_strlen , & file_out , & name_len ) == SUCCESS ) {
2813
- /* TODO: Use zend_is_numeric_string/ subroutine? */
2812
+ /* TODO: Use subroutine? */
2814
2813
oid = (Oid )strtoul (oid_string , & end_ptr , 10 );
2815
2814
if ((oid_string + oid_strlen ) != end_ptr ) {
2816
2815
/* wrong integer format */
@@ -5373,7 +5372,7 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
5373
5372
5374
5373
ZEND_HASH_FOREACH_STR_KEY (Z_ARRVAL_P (var_array ), fld ) {
5375
5374
if (fld == NULL ) {
5376
- zend_value_error ("Array of values must be an associative array of string keys" );
5375
+ zend_value_error ("Array of values must be an associative array with string keys" );
5377
5376
goto cleanup ;
5378
5377
}
5379
5378
if (opt & PGSQL_DML_ESCAPE ) {
@@ -5546,7 +5545,7 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr,
5546
5545
5547
5546
ZEND_HASH_FOREACH_STR_KEY_VAL (ht , fld , val ) {
5548
5547
if (fld == NULL ) {
5549
- zend_value_error ("Array of values must be an associated array of string keys" );
5548
+ zend_value_error ("Array of values must be an associative array with string keys" );
5550
5549
return -1 ;
5551
5550
}
5552
5551
if (opt & PGSQL_DML_ESCAPE ) {
0 commit comments