com php-src: Squash some more PHP 7 diffs and improve test portability (Senthil): ext/oci8/oci8_statement.c ext/oci8/tests /bind_char_1.phpt
ext/oci8/tests/bind_char_1 _11gR1.phpt ext/oci8/tests/bind_char_2.ph pt ext/oci8/tests/bind_char_2_11gR1.phpt ext/oci8/tests/bind_char_3.phpt
ext/oci8/tests/bi nd_char_3_11gR1.phpt ext/oci8/tests/bind_ char_4.phpt ext/oci8/tests/bind_char_4_11 gR1.phpt ext/oci8/tests/bind_long.phpt ext/oci8
/tests/bug51253.phpt ext

From: Date: Wed, 26 Aug 2015 11:22:58 +0000
Subject: com php-src: Squash some more PHP 7 diffs and improve test portability (Senthil): ext/oci8/oci8_statement.c ext/oci8/tests /bind_char_1.phpt
ext/oci8/tests/bind_char_1 _11gR1.phpt ext/oci8/tests/bind_char_2.ph pt ext/oci8/tests/bind_char_2_11gR1.phpt ext/oci8/tests/bind_char_3.phpt
ext/oci8/tests/bi nd_char_3_11gR1.phpt ext/oci8/tests/bind_ char_4.phpt ext/oci8/tests/bind_char_4_11 gR1.phpt ext/oci8/tests/bind_long.phpt ext/oci8
/tests/bug51253.phpt ext
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88755@lists.php.net to get a copy of this message
Commit: a52902faf48d3d634e712961c4226dea24f402c7 Author: Christopher Jones <christopher.jones@oracle.com> Wed, 26 Aug 2015 21:22:58 +1000 Parents: 371eba811fa55d7eab4168e1b90a2b3beb10aa2b Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a52902faf48d3d634e712961c4226dea24f402c7 Log: Squash some more PHP 7 diffs and improve test portability (Senthil) Changed paths: M ext/oci8/oci8_statement.c M ext/oci8/tests/bind_char_1.phpt M ext/oci8/tests/bind_char_1_11gR1.phpt M ext/oci8/tests/bind_char_2.phpt M ext/oci8/tests/bind_char_2_11gR1.phpt M ext/oci8/tests/bind_char_3..phpt M ext/oci8/tests/bind_char_3_11gR1.phpt M ext/oci8/tests/bind_char_4.phpt M ext/oci8/tests/bind_char_4_11gR1.phpt M ext/oci8/tests/bind_long.phpt M ext/oci8/tests/bug51253.phpt M ext/oci8/tests/lob_009.phpt M ext/oci8/tests/lob_023.phpt

diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c index 3ab2499..a23ed2b 100644 --- a/ext/oci8/oci8_statement.c +++ b/ext/oci8/oci8_statement.c @@ -1166,18 +1166,16 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l if (Z_TYPE_P(var) != IS_NULL) { convert_to_string(var); } - if (maxlength == -1) { - /* - value_sz = (Z_TYPE_P(var) == IS_STRING) ? Z_STRLEN_P(var) : PHP_OCI_PIECE_SIZE; - */ - /* We should use max length as dynamic bind is used */ - value_sz = PHP_OCI_PIECE_SIZE; - } else { - if (maxlength == 0) { - value_sz = PHP_OCI_PIECE_SIZE; + if ((maxlength == -1) || (maxlength == 0)) { + if (type == SQLT_LNG) { + value_sz = SB4MAXVAL; + } else if (Z_TYPE_P(var) == IS_STRING) { + value_sz = (sb4) Z_STRLEN_P(var); } else { - value_sz = (sb4) maxlength; + value_sz = PHP_OCI_PIECE_SIZE; } + } else { + value_sz = (sb4) maxlength; } break; @@ -1225,10 +1223,6 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l break; } - if (value_sz == 0) { - value_sz = 1; - } - if (!statement->binds) { ALLOC_HASHTABLE(statement->binds); zend_hash_init(statement->binds, 13, NULL, php_oci_bind_hash_dtor, 0); @@ -1249,7 +1243,12 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l bindp->parent_statement = statement; bindp->zval = var; bindp->type = type; - + /* Storing max length set in OCIBindByName() to check it later in + * php_oci_bind_in_callback() function to avoid ORA-1406 error while + * executing OCIStmtExecute() + */ + bindp->dummy_len = value_sz; + PHP_OCI_CALL_RETURN(errstatus, OCIBindByName, ( @@ -1353,6 +1352,14 @@ sb4 php_oci_bind_in_callback( *bufpp = Z_STRVAL_P(val); *alenp = (ub4) Z_STRLEN_P(val); + /* + * bind_char_1: If max length set in OCIBindByName is less than the + * actual length of input string, then we have to overwrite alenp with + * max value set in OCIBindByName (dummy_len). Or else it will cause + * ORA-1406 error in OCIStmtExecute + */ + if ((phpbind->dummy_len > 0) && (phpbind->dummy_len < *alenp)) + *alenp = phpbind->dummy_len; *indpp = (dvoid *)&phpbind->indicator; } else if (phpbind->statement != 0) { /* RSET */ diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt index dc162ff..bb368fc 100644 --- a/ext/oci8/tests/bind_char_1.phpt +++ b/ext/oci8/tests/bind_char_1.phpt @@ -11,7 +11,7 @@ if (!(isset($matches[0]) && $matches[1] >= 12)) { } ?> --ENV-- -NLS_LANG= +NLS_LANG=.AL32UTF8 --FILE-- <?php @@ -223,9 +223,6 @@ Test 1.4: Type: AFC: Length: strlen :: Test 1.5: Type: AFC. Length: strlen-1 Querying: - :1: - :abc : - :: Test 1.6: Type: AFC. Length: strlen+1 Querying: :1: @@ -271,9 +268,6 @@ Test 3.4: Type: AFC: Length: strlen :abc: Test 3.5: Type: AFC. Length: strlen-1 Querying: - :2: - :: - :abc: Test 3.6: Type: AFC. Length: strlen+1 Querying: :2: diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt index bdc29f7..5b22cdc 100644 --- a/ext/oci8/tests/bind_char_1_11gR1.phpt +++ b/ext/oci8/tests/bind_char_1_11gR1.phpt @@ -11,7 +11,7 @@ if (!(isset($matches[0]) && $matches[1] < 12)) { } ?> --ENV-- -NLS_LANG= +NLS_LANG=.AL32UTF8 --FILE-- <?php @@ -215,7 +215,9 @@ Test 1.2: Type: AFC. Length: default :: Test 1.3: Type: AFC: Length: 0 Querying: - Oci_execute error ORA-1460 Exiting Query + :1: + :abc : + :: Test 1.4: Type: AFC: Length: strlen Querying: :1: @@ -223,7 +225,6 @@ Test 1.4: Type: AFC: Length: strlen :: Test 1.5: Type: AFC. Length: strlen-1 Querying: - Oci_execute error ORA-1460 Exiting Query Test 1.6: Type: AFC. Length: strlen+1 Querying: :1: @@ -259,7 +260,9 @@ Test 3.2: Type: AFC. Length: default :abc: Test 3.3: Type: AFC: Length: 0 Querying: - Oci_execute error ORA-1460 Exiting Query + :2: + :: + :abc: Test 3.4: Type: AFC: Length: strlen Querying: :2: @@ -267,7 +270,6 @@ Test 3.4: Type: AFC: Length: strlen :abc: Test 3.5: Type: AFC. Length: strlen-1 Querying: - Oci_execute error ORA-1460 Exiting Query Test 3.6: Type: AFC. Length: strlen+1 Querying: :2: diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt index 9c61a85..57b0c61 100644 --- a/ext/oci8/tests/bind_char_2.phpt +++ b/ext/oci8/tests/bind_char_2.phpt @@ -11,7 +11,7 @@ if (!(isset($matches[0]) && $matches[1] >= 12)) { } ?> --ENV-- -NLS_LANG= +NLS_LANG=.AL32UTF8 --FILE-- <?php @@ -102,15 +102,14 @@ Test 1.2: Type: AFC. Length: default :2008-04-20: Test 1.3: Type: AFC: Length: 0 Querying: - Oci_execute error ORA-1460 Exiting Query + :1: + :2008-04-20: Test 1.4: Type: AFC: Length: strlen Querying: :1: :2008-04-20: Test 1.5: Type: AFC. Length: strlen-1 Querying: - :1: - :2008-04-20: Test 1.6: Type: AFC. Length: strlen+1 Querying: :1: diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt index 06c37af..438885e 100644 --- a/ext/oci8/tests/bind_char_2_11gR1.phpt +++ b/ext/oci8/tests/bind_char_2_11gR1.phpt @@ -11,7 +11,7 @@ if (!(isset($matches[0]) && $matches[1] < 12)) { } ?> --ENV-- -NLS_LANG= +NLS_LANG=.AL32UTF8 --FILE-- <?php @@ -102,14 +102,14 @@ Test 1.2: Type: AFC. Length: default :2008-04-20: Test 1.3: Type: AFC: Length: 0 Querying: - Oci_execute error ORA-1460 Exiting Query + :1: + :2008-04-20: Test 1.4: Type: AFC: Length: strlen Querying: :1: :2008-04-20: Test 1.5: Type: AFC. Length: strlen-1 Querying: - Oci_execute error ORA-1460 Exiting Query Test 1.6: Type: AFC. Length: strlen+1 Querying: :1: diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt index 177676e..67aafae 100644 --- a/ext/oci8/tests/bind_char_3.phpt +++ b/ext/oci8/tests/bind_char_3.phpt @@ -11,7 +11,7 @@ if (!(isset($matches[0]) && $matches[1] >= 12)) { } ?> --ENV-- -NLS_LANG= +NLS_LANG=.AL32UTF8 --FILE-- <?php @@ -259,19 +259,20 @@ string(3) "abc" Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC Executing: string(3) "abc" -string(30) "abc " +string(10) "abc " Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC Executing: string(3) "abc" -string(9) "abc " +string(3) "abc" Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC Executing: + Oci_execute error ORA-6502 +string(3) "abc" string(3) "abc" -string(6) "abc " Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC Executing: string(3) "abc" -string(12) "abc " +string(4) "abc " Tests with '' diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt index c3ec999..5c8b286 100644 --- a/ext/oci8/tests/bind_char_3_11gR1.phpt +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -11,7 +11,7 @@ if (!(isset($matches[0]) && $matches[1] < 12)) { } ?> --ENV-- -NLS_LANG= +NLS_LANG=.AL32UTF8 --FILE-- <?php @@ -246,9 +246,8 @@ echo "Done\n"; --EXPECTF-- Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default Executing: - Oci_execute error ORA-6502 string(3) "abc" -NULL +string(3) "abc" Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default Executing: string(3) "abc" diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt index b4d3e08..9ca369a 100644 --- a/ext/oci8/tests/bind_char_4.phpt +++ b/ext/oci8/tests/bind_char_4.phpt @@ -11,7 +11,7 @@ if (!(isset($matches[0]) && $matches[1] >= 12)) { } ?> --ENV-- -NLS_LANG= +NLS_LANG=.AL32UTF8 --FILE-- <?php @@ -261,19 +261,20 @@ string(3) "abc" Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC Executing: string(3) "abc" -string(30) "abc " +string(10) "abc " Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC Executing: string(3) "abc" -string(9) "abc " +string(3) "abc" Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC Executing: + Oci_execute error ORA-6502 +string(3) "abc" string(3) "abc" -string(6) "abc " Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC Executing: string(3) "abc" -string(12) "abc " +string(4) "abc " Tests with '' diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt index ccad2cb..56a666e 100644 --- a/ext/oci8/tests/bind_char_4_11gR1.phpt +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -11,7 +11,7 @@ if (!(isset($matches[0]) && $matches[1] < 12)) { } ?> --ENV-- -NLS_LANG= +NLS_LANG=.AL32UTF8 --FILE-- <?php @@ -248,9 +248,8 @@ echo "Done\n"; --EXPECTF-- Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default Executing: - Oci_execute error ORA-6502 string(3) "abc" -NULL +string(3) "abc" Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default Executing: string(3) "abc" diff --git a/ext/oci8/tests/bind_long.phpt b/ext/oci8/tests/bind_long.phpt index 40c5799..cbd8312 100644 --- a/ext/oci8/tests/bind_long.phpt +++ b/ext/oci8/tests/bind_long.phpt @@ -20,8 +20,8 @@ echo "Test 1\n"; $stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)"); $i=1; -$filetxt = file_get_contents( dirname(__FILE__)."/test.txt"); - +$filetxt1 = file_get_contents( dirname(__FILE__)."/test.txt"); +$filetxt = str_replace("\r", "", $filetxt1); oci_bind_by_name( $stmt, ":id", $i, -1); oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG); diff --git a/ext/oci8/tests/bug51253.phpt b/ext/oci8/tests/bug51253.phpt index 111da92..b38bc76 100644 --- a/ext/oci8/tests/bug51253.phpt +++ b/ext/oci8/tests/bug51253.phpt @@ -93,15 +93,15 @@ echo "Done\n"; Test 1 array(5) { [0]=> - string(4) "five" + string(3) "one" [1]=> - string(4) "four" + string(3) "two" [2]=> string(5) "three" [3]=> - string(3) "two" + string(4) "four" [4]=> - string(3) "one" + string(4) "five" } array(5) { [0]=> diff --git a/ext/oci8/tests/lob_009.phpt b/ext/oci8/tests/lob_009.phpt index 4702e61..dc7c1b4 100644 --- a/ext/oci8/tests/lob_009.phpt +++ b/ext/oci8/tests/lob_009.phpt @@ -35,7 +35,7 @@ oci_execute($s, OCI_DEFAULT); var_dump($row = oci_fetch_array($s)); while (!$row[0]->eof()) { - var_dump($row[0]->read(1024)); + var_dump(str_replace("\r", "", $row[0]->read(1024))); } require dirname(__FILE__).'/drop_table.inc'; diff --git a/ext/oci8/tests/lob_023.phpt b/ext/oci8/tests/lob_023.phpt index 6416fb4..1a1ee80 100644 --- a/ext/oci8/tests/lob_023.phpt +++ b/ext/oci8/tests/lob_023.phpt @@ -40,7 +40,7 @@ oci_execute($s, OCI_DEFAULT); var_dump($row = oci_fetch_array($s)); while (!$row[0]->eof()) { - var_dump($row[0]->read(1024)); + var_dump(str_replace("\r", "", $row[0]->read(1024))); } require dirname(__FILE__).'/drop_table.inc';
« previous php.cvs (#88755) next »