Skip to content

Commit 2b6d609

Browse files
committed
Correct method vs. function arg number usage in error messages
1 parent af842a9 commit 2b6d609

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

ext/oci8/oci8_interface.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#define OCI_STMT_CALL 10
4141
#endif
4242

43+
#define ERROR_ARG_POS(arg_num) (getThis() ? (arg_num-1) : (arg_num))
44+
4345
/* {{{ Register a callback function for Oracle Transparent Application Failover (TAF) */
4446
PHP_FUNCTION(oci_register_taf_callback)
4547
{
@@ -258,7 +260,7 @@ PHP_FUNCTION(oci_lob_save)
258260
}
259261

260262
if (offset < 0) {
261-
zend_argument_value_error(2, "must be greater than or equal to 0");
263+
zend_argument_value_error(ERROR_ARG_POS(3), "must be greater than or equal to 0");
262264
RETURN_THROWS();
263265
}
264266

@@ -350,7 +352,7 @@ PHP_FUNCTION(oci_lob_read)
350352
}
351353

352354
if (length <= 0) {
353-
zend_argument_value_error(1, "must be greater than 0");
355+
zend_argument_value_error(ERROR_ARG_POS(2), "must be greater than 0");
354356
RETURN_THROWS();
355357
}
356358

@@ -600,7 +602,7 @@ PHP_FUNCTION(oci_lob_truncate)
600602
}
601603

602604
if (trim_length < 0) {
603-
zend_argument_value_error(1, "must be greater than or equal to zero");
605+
zend_argument_value_error(ERROR_ARG_POS(2), "must be greater than or equal to 0");
604606
RETURN_THROWS();
605607
}
606608

@@ -635,14 +637,14 @@ PHP_FUNCTION(oci_lob_erase)
635637
if (offset_is_null) {
636638
offset = -1;
637639
} else if (offset < 0) {
638-
zend_argument_value_error(1, "must be greater than or equal to 0");
640+
zend_argument_value_error(ERROR_ARG_POS(2), "must be greater than or equal to 0");
639641
RETURN_THROWS();
640642
}
641643

642644
if (length_is_null) {
643645
length = -1;
644646
} else if (length < 0) {
645-
zend_argument_value_error(2, "must be greater than or equal to 0");
647+
zend_argument_value_error(ERROR_ARG_POS(3), "must be greater than or equal to 0");
646648
RETURN_THROWS();
647649
}
648650

@@ -833,14 +835,14 @@ PHP_FUNCTION(oci_lob_export)
833835
if (start_is_null) {
834836
start = -1;
835837
} else if (start < 0) {
836-
zend_argument_value_error(2, "must be greater than or equal to 0");
838+
zend_argument_value_error(ERROR_ARG_POS(3), "must be greater than or equal to 0");
837839
RETURN_THROWS();
838840
}
839841

840842
if (length_is_null) {
841843
length = -1;
842844
} else if (length < 0) {
843-
zend_argument_value_error(3, "must be greater than or equal to 0");
845+
zend_argument_value_error(ERROR_ARG_POS(4), "must be greater than or equal to 0");
844846
RETURN_THROWS();
845847
}
846848

ext/oci8/tests/lob_027.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ bool(true)
104104
string(10) "this is a "
105105
bool(true)
106106
string(0) ""
107-
OCILob::truncate(): Argument #1 ($length) must be greater than or equal to zero
107+
OCILob::truncate(): Argument #1 ($length) must be greater than or equal to 0
108108
string(0) ""
109109
bool(true)
110-
OCILob::truncate(): Argument #1 ($length) must be greater than or equal to zero
110+
OCILob::truncate(): Argument #1 ($length) must be greater than or equal to 0
111111
Done

ext/oci8/tests/lob_042.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ bool(false)
7171

7272
Warning: OCILob::savefile(): Can't open file %s in %s on line %d
7373
bool(false)
74-
OCILob::truncate(): Argument #1 ($length) must be greater than or equal to zero
74+
OCILob::truncate(): Argument #1 ($length) must be greater than or equal to 0
7575
Done

0 commit comments

Comments
 (0)