Skip to content

Commit 8f2e6da

Browse files
committed
Fixed bug #71422 (Fix ORA-01438: value larger than specified precision allowed for this column)
1 parent c1f597d commit 8f2e6da

File tree

5 files changed

+94
-7
lines changed

5 files changed

+94
-7
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ PHP NEWS
1515
. Fixed bug #71889 (DateInterval::format Segmentation fault).
1616
(Thomas Punt)
1717

18+
- OCI8:
19+
. Fixed bug #71422 (Fix ORA-01438: value larger than specified precision
20+
allowed for this column)
21+
1822
- ODBC:
1923
. Fixed bug #63171 (Script hangs after max_execution_time). (Remi)
2024

ext/oci8/oci8_statement.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,9 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
11451145
return 1;
11461146
}
11471147
convert_to_long(var);
1148-
#if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION > 10
1148+
1149+
#if defined(OCI_MAJOR_VERSION) && (OCI_MAJOR_VERSION > 10) && \
1150+
(defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64))
11491151
bind_data = (ub8 *)&Z_LVAL_P(var);
11501152
value_sz = sizeof(ub8);
11511153
#else

ext/oci8/package.xml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
99

1010
<description>
1111
Use the OCI8 extension to access Oracle Database. PHP OCI8 2.1 builds
12-
with PHP 7. Use 'pecl install oci8-2.0.10' to install OCI8 for PHP
12+
with PHP 7. Use 'pecl install oci8-2.0.11' to install OCI8 for PHP
1313
5.2 - PHP 5.6. Use 'pecl install oci8-1.4.10' to install PHP OCI8 1.4
1414
for PHP 4.3.9 - PHP 5.1. The OCI8 extension can be linked with Oracle
1515
client libraries from Oracle Database 12.1, 11, or 10.2. These
@@ -46,20 +46,20 @@ Interoperability Support" (ID 207303.1) for details.
4646
<active>no</active>
4747
</lead>
4848

49-
<date>2015-12-12</date>
49+
<date>2016-04-15</date>
5050
<time>12:00:00</time>
5151

5252
<version>
53-
<release>2.0.10</release>
54-
<api>2.0.10</api>
53+
<release>2.0.11</release>
54+
<api>2.0.11</api>
5555
</version>
5656
<stability>
5757
<release>stable</release>
5858
<api>stable</api>
5959
</stability>
6060
<license uri="http://www.php.net/license">PHP</license>
6161
<notes>
62-
Fixed bug #68298 (OCI int overflow)
62+
Fixed bug #71422 (Fix ORA-01438: value larger than specified precision allowed for this column)
6363
</notes>
6464
<contents>
6565
<dir name="/">
@@ -159,6 +159,7 @@ Fixed bug #68298 (OCI int overflow)
159159
<file name="bug51291_1.phpt" role="test" />
160160
<file name="bug51291_2.phpt" role="test" />
161161
<file name="bug68298.phpt" role="test" />
162+
<file name="bug71422.phpt" role="test" />
162163
<file name="clientversion.phpt" role="test" />
163164
<file name="close.phpt" role="test" />
164165
<file name="coll_001.phpt" role="test" />
@@ -464,6 +465,21 @@ Fixed bug #68298 (OCI int overflow)
464465
</extsrcrelease>
465466
<changelog>
466467

468+
<release>
469+
<version>
470+
<release>2.0.10</release>
471+
<api>2.0.10</api>
472+
</version>
473+
<stability>
474+
<release>stable</release>
475+
<api>stable</api>
476+
</stability>
477+
<license uri="http://www.php.net/license">PHP</license>
478+
<notes>
479+
Fixed bug #68298 (OCI int overflow)
480+
</notes>
481+
</release>
482+
467483
<release>
468484
<version>
469485
<release>2.0.9</release>

ext/oci8/php_oci8.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
*/
4646
#undef PHP_OCI8_VERSION
4747
#endif
48-
#define PHP_OCI8_VERSION "2.0.10"
48+
#define PHP_OCI8_VERSION "2.0.11"
4949

5050
extern zend_module_entry oci8_module_entry;
5151
#define phpext_oci8_ptr &oci8_module_entry

ext/oci8/tests/bug71422.phpt

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
--TEST--
2+
Bug #71422 (Fix ORA-01438: value larger than specified precision allowed for this column)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
6+
?>
7+
--FILE--
8+
<?php
9+
10+
require(dirname(__FILE__).'/connect.inc');
11+
12+
$stmtarray = array(
13+
"DROP TABLE BUG71422_TEST",
14+
"CREATE TABLE BUG71422_TEST (TEST_ID NUMBER(*,0) NOT NULL, LABEL VARCHAR2(50 CHAR), CONSTRAINT BUG71422_TEST_PK PRIMARY KEY (TEST_ID))",
15+
"INSERT INTO BUG71422_TEST (TEST_ID, LABEL) VALUES (1, 'Foo')"
16+
);
17+
18+
oci8_test_sql_execute($c, $stmtarray);
19+
20+
$stmt = oci_parse($c, 'SELECT LABEL AS RAW_QUERY FROM BUG71422_TEST WHERE TEST_ID=1');
21+
oci_execute($stmt);
22+
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
23+
var_dump($row);
24+
}
25+
26+
$stmt = oci_parse($c, 'SELECT LABEL AS NUMERIC_BIND_PARAMETER FROM BUG71422_TEST WHERE TEST_ID=:test_id');
27+
$value = 1;
28+
oci_bind_by_name($stmt, ':test_id', $value, -1, SQLT_INT);
29+
oci_execute($stmt);
30+
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
31+
var_dump($row);
32+
}
33+
34+
$stmt = oci_parse($c, 'SELECT LABEL AS STRING_BIND_PARAMETER FROM BUG71422_TEST WHERE TEST_ID=:test_id');
35+
$value = 1;
36+
oci_bind_by_name($stmt, ':test_id', $value, -1, SQLT_CHR);
37+
oci_execute($stmt);
38+
while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
39+
var_dump($row);
40+
}
41+
42+
// Cleanup
43+
44+
$stmtarray = array(
45+
"DROP TABLE BUG71422_TEST"
46+
);
47+
oci8_test_sql_execute($c, $stmtarray);
48+
49+
?>
50+
===DONE===
51+
<?php exit(0); ?>
52+
--EXPECTF--
53+
array(1) {
54+
["RAW_QUERY"]=>
55+
string(3) "Foo"
56+
}
57+
array(1) {
58+
["NUMERIC_BIND_PARAMETER"]=>
59+
string(3) "Foo"
60+
}
61+
array(1) {
62+
["STRING_BIND_PARAMETER"]=>
63+
string(3) "Foo"
64+
}
65+
===DONE===

0 commit comments

Comments
 (0)