@@ -109,8 +109,8 @@ PHP_FUNCTION(oci_define_by_name)
109
109
ZEND_PARSE_PARAMETERS_END ();
110
110
111
111
if (!name_len ) {
112
- php_error_docref ( NULL , E_WARNING , "Column name cannot be empty" );
113
- RETURN_FALSE ;
112
+ zend_argument_value_error ( 2 , " cannot be empty" );
113
+ RETURN_THROWS () ;
114
114
}
115
115
116
116
PHP_OCI_ZVAL_TO_STATEMENT (stmt , statement );
@@ -210,8 +210,8 @@ PHP_FUNCTION(oci_bind_array_by_name)
210
210
}
211
211
212
212
if (max_array_len <= 0 ) {
213
- php_error_docref ( NULL , E_WARNING , "Maximum array length must be greater than zero " );
214
- RETURN_FALSE ;
213
+ zend_argument_value_error ( 4 , " must be greater than 0 " );
214
+ RETURN_THROWS () ;
215
215
}
216
216
217
217
if (php_oci_bind_array_by_name (statement , name , (sb4 ) name_len , bind_var , max_array_len , max_item_len , type )) {
@@ -257,18 +257,18 @@ PHP_FUNCTION(oci_lob_save)
257
257
RETURN_THROWS ();
258
258
}
259
259
260
+ if (offset < 0 ) {
261
+ zend_argument_value_error (3 , "must be greater than or equal to 0" );
262
+ RETURN_THROWS ();
263
+ }
264
+
260
265
if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
261
266
php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
262
267
RETURN_FALSE ;
263
268
}
264
269
265
270
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
266
271
267
- if (offset < 0 ) {
268
- php_error_docref (NULL , E_WARNING , "Offset parameter must be greater than or equal to 0" );
269
- RETURN_FALSE ;
270
- }
271
-
272
272
if (php_oci_lob_write (descriptor , (ub4 ) offset , data , (ub4 ) data_len , & bytes_written )) {
273
273
RETURN_FALSE ;
274
274
}
@@ -284,7 +284,7 @@ PHP_FUNCTION(oci_lob_import)
284
284
char * filename ;
285
285
size_t filename_len ;
286
286
287
- if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Os " , & z_descriptor , oci_lob_class_entry_ptr , & filename , & filename_len ) == FAILURE ) {
287
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Op " , & z_descriptor , oci_lob_class_entry_ptr , & filename , & filename_len ) == FAILURE ) {
288
288
RETURN_THROWS ();
289
289
}
290
290
@@ -293,11 +293,6 @@ PHP_FUNCTION(oci_lob_import)
293
293
RETURN_FALSE ;
294
294
}
295
295
296
- if (CHECK_NULL_PATH (filename , filename_len )) {
297
- php_error_docref (NULL , E_WARNING , "filename must not contain null bytes" );
298
- RETURN_FALSE ;
299
- }
300
-
301
296
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
302
297
303
298
if (php_oci_lob_import (descriptor , filename )) {
@@ -354,18 +349,18 @@ PHP_FUNCTION(oci_lob_read)
354
349
RETURN_THROWS ();
355
350
}
356
351
352
+ if (length <= 0 ) {
353
+ zend_argument_value_error (2 , "must be greater than 0" );
354
+ RETURN_THROWS ();
355
+ }
356
+
357
357
if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
358
358
php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
359
359
RETURN_FALSE ;
360
360
}
361
361
362
362
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
363
363
364
- if (length <= 0 ) {
365
- php_error_docref (NULL , E_WARNING , "Length parameter must be greater than 0" );
366
- RETURN_FALSE ;
367
- }
368
-
369
364
if (php_oci_lob_read (descriptor , length , descriptor -> lob_current_position , & buffer , & buffer_len )) {
370
365
RETURN_FALSE ;
371
366
}
@@ -604,13 +599,13 @@ PHP_FUNCTION(oci_lob_truncate)
604
599
RETURN_THROWS ();
605
600
}
606
601
607
- if (( tmp = zend_hash_str_find ( Z_OBJPROP_P ( z_descriptor ), "descriptor" , sizeof ( "descriptor" ) - 1 )) == NULL ) {
608
- php_error_docref ( NULL , E_WARNING , "Unable to find descriptor property " );
609
- RETURN_FALSE ;
602
+ if (trim_length < 0 ) {
603
+ zend_argument_value_error ( 2 , "must be greater than or equal to zero " );
604
+ RETURN_THROWS () ;
610
605
}
611
606
612
- if (trim_length < 0 ) {
613
- php_error_docref (NULL , E_WARNING , "Length must be greater than or equal to zero " );
607
+ if (( tmp = zend_hash_str_find ( Z_OBJPROP_P ( z_descriptor ), "descriptor" , sizeof ( "descriptor" ) - 1 )) == NULL ) {
608
+ php_error_docref (NULL , E_WARNING , "Unable to find descriptor property " );
614
609
RETURN_FALSE ;
615
610
}
616
611
@@ -640,15 +635,15 @@ PHP_FUNCTION(oci_lob_erase)
640
635
if (offset_is_null ) {
641
636
offset = -1 ;
642
637
} else if (offset < 0 ) {
643
- php_error_docref ( NULL , E_WARNING , "Offset must be greater than or equal to 0" );
644
- RETURN_FALSE ;
638
+ zend_argument_value_error ( 2 , " must be greater than or equal to 0" );
639
+ RETURN_THROWS () ;
645
640
}
646
641
647
642
if (length_is_null ) {
648
643
length = -1 ;
649
644
} else if (length < 0 ) {
650
- php_error_docref ( NULL , E_WARNING , "Length must be greater than or equal to 0" );
651
- RETURN_FALSE ;
645
+ zend_argument_value_error ( 3 , " must be greater than or equal to 0" );
646
+ RETURN_THROWS () ;
652
647
}
653
648
654
649
if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
@@ -756,6 +751,13 @@ PHP_FUNCTION(oci_lob_copy)
756
751
RETURN_THROWS ();
757
752
}
758
753
754
+ if (length_is_null ) {
755
+ length = -1 ;
756
+ } else if (length < 0 ) {
757
+ zend_argument_value_error (3 , "must be greater than or equal to 0" );
758
+ RETURN_THROWS ();
759
+ }
760
+
759
761
if ((tmp_dest = zend_hash_str_find (Z_OBJPROP_P (z_descriptor_dest ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
760
762
php_error_docref (NULL , E_WARNING , "Unable to find descriptor property. The first argument should be valid descriptor object" );
761
763
RETURN_FALSE ;
@@ -769,13 +771,6 @@ PHP_FUNCTION(oci_lob_copy)
769
771
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp_dest , descriptor_dest );
770
772
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp_from , descriptor_from );
771
773
772
- if (length_is_null ) {
773
- length = -1 ;
774
- } else if (length < 0 ) {
775
- php_error_docref (NULL , E_WARNING , "Length parameter must be greater than 0" );
776
- RETURN_FALSE ;
777
- }
778
-
779
774
if (php_oci_lob_copy (descriptor_dest , descriptor_from , length )) {
780
775
RETURN_FALSE ;
781
776
}
@@ -831,34 +826,29 @@ PHP_FUNCTION(oci_lob_export)
831
826
php_stream * stream ;
832
827
ub4 lob_length ;
833
828
834
- if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Os |l!l!" , & z_descriptor , oci_lob_class_entry_ptr , & filename , & filename_len , & start , & start_is_null , & length , & length_is_null ) == FAILURE ) {
829
+ if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "Op |l!l!" , & z_descriptor , oci_lob_class_entry_ptr , & filename , & filename_len , & start , & start_is_null , & length , & length_is_null ) == FAILURE ) {
835
830
RETURN_THROWS ();
836
831
}
837
832
838
833
if (start_is_null ) {
839
834
start = -1 ;
840
835
} else if (start < 0 ) {
841
- php_error_docref ( NULL , E_WARNING , "Start parameter must be greater than or equal to 0" );
842
- RETURN_FALSE ;
836
+ zend_argument_value_error ( 3 , " must be greater than or equal to 0" );
837
+ RETURN_THROWS () ;
843
838
}
844
839
845
840
if (length_is_null ) {
846
841
length = -1 ;
847
842
} else if (length < 0 ) {
848
- php_error_docref ( NULL , E_WARNING , "length parameter must be greater than or equal to 0" );
849
- RETURN_FALSE ;
843
+ zend_argument_value_error ( 4 , " must be greater than or equal to 0" );
844
+ RETURN_THROWS () ;
850
845
}
851
846
852
847
if ((tmp = zend_hash_str_find (Z_OBJPROP_P (z_descriptor ), "descriptor" , sizeof ("descriptor" )- 1 )) == NULL ) {
853
848
php_error_docref (NULL , E_WARNING , "Unable to find descriptor property" );
854
849
RETURN_FALSE ;
855
850
}
856
851
857
- if (CHECK_NULL_PATH (filename , filename_len )) {
858
- php_error_docref (NULL , E_WARNING , "filename must not contain null bytes" );
859
- RETURN_FALSE ;
860
- }
861
-
862
852
PHP_OCI_ZVAL_TO_DESCRIPTOR (tmp , descriptor );
863
853
864
854
if (php_oci_lob_get_length (descriptor , & lob_length )) {
@@ -1630,8 +1620,8 @@ PHP_FUNCTION(oci_set_prefetch)
1630
1620
PHP_OCI_ZVAL_TO_STATEMENT (z_statement , statement );
1631
1621
1632
1622
if (size < 0 ) {
1633
- php_error_docref ( NULL , E_WARNING , "Number of rows to be prefetched has to be greater than or equal to 0" );
1634
- return ;
1623
+ zend_argument_value_error ( 2 , "must be greater than or equal to 0" );
1624
+ RETURN_THROWS () ;
1635
1625
}
1636
1626
1637
1627
if (php_oci_statement_set_prefetch (statement , (ub4 )size )) {
@@ -1899,16 +1889,16 @@ PHP_FUNCTION(oci_password_change)
1899
1889
PHP_OCI_ZVAL_TO_CONNECTION (z_connection , connection );
1900
1890
1901
1891
if (!user_len ) {
1902
- php_error_docref ( NULL , E_WARNING , "Username cannot be empty" );
1903
- RETURN_FALSE ;
1892
+ zend_argument_value_error ( 2 , " cannot be empty" );
1893
+ RETURN_THROWS () ;
1904
1894
}
1905
1895
if (!pass_old_len ) {
1906
- php_error_docref ( NULL , E_WARNING , "Old password cannot be empty" );
1907
- RETURN_FALSE ;
1896
+ zend_argument_value_error ( 3 , " cannot be empty" );
1897
+ RETURN_THROWS () ;
1908
1898
}
1909
1899
if (!pass_new_len ) {
1910
- php_error_docref ( NULL , E_WARNING , "New password cannot be empty" );
1911
- RETURN_FALSE ;
1900
+ zend_argument_value_error ( 4 , " cannot be empty" );
1901
+ RETURN_THROWS () ;
1912
1902
}
1913
1903
1914
1904
if (php_oci_password_change (connection , user , (int ) user_len , pass_old , (int ) pass_old_len , pass_new , (int ) pass_new_len )) {
@@ -1918,16 +1908,16 @@ PHP_FUNCTION(oci_password_change)
1918
1908
} else if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "ssss" , & dbname , & dbname_len , & user , & user_len , & pass_old , & pass_old_len , & pass_new , & pass_new_len ) == SUCCESS ) {
1919
1909
1920
1910
if (!user_len ) {
1921
- php_error_docref ( NULL , E_WARNING , "Username cannot be empty" );
1922
- RETURN_FALSE ;
1911
+ zend_argument_value_error ( 2 , " cannot be empty" );
1912
+ RETURN_THROWS () ;
1923
1913
}
1924
1914
if (!pass_old_len ) {
1925
- php_error_docref ( NULL , E_WARNING , "Old password cannot be empty" );
1926
- RETURN_FALSE ;
1915
+ zend_argument_value_error ( 3 , " cannot be empty" );
1916
+ RETURN_THROWS () ;
1927
1917
}
1928
1918
if (!pass_new_len ) {
1929
- php_error_docref ( NULL , E_WARNING , "New password cannot be empty" );
1930
- RETURN_FALSE ;
1919
+ zend_argument_value_error ( 4 , " cannot be empty" );
1920
+ RETURN_THROWS () ;
1931
1921
}
1932
1922
1933
1923
connection = php_oci_do_connect_ex (user , (int ) user_len , pass_old , (int ) pass_old_len , pass_new , (int ) pass_new_len , dbname , (int ) dbname_len , NULL , OCI_DEFAULT , 0 , 0 );
0 commit comments