From: roger dot robins at det dot nsw dot edu dot au Operating system: Linux Redhat ES 3.0 PHP version: 5.2.9 PHP Bug Type: OCI8 related Bug description: oci_bind_by_name returning wrong id value
Description: ------------ When INSERTing a record into a table that has a database sequence for calculating the table id (unique identifier) and that sequence's next_val has reached double figures; and you use oci_bind_by_name to return the id of the inserted row; then only the first digit of the two digit row id is returned. Code: $sql = "INSERT INTO {$this->prefix}$table ($fields) VALUES($values) $returning"; $id = null; $this->query_start($sql, $params, SQL_QUERY_INSERT); $stmt = $this->parse_query($sql); $descriptors = $this->bind_params($stmt, $params, $table); if ($returning) { oci_bind_by_name($stmt, ":oracle_id", $id, -1, SQLT_LNG); } $result = oci_execute($stmt); $this->free_descriptors($descriptors); $this->query_end($result, $stmt); oci_free_statement($stmt); Reproduce code: --------------- Environment: PHP 5.2.9 compiled again Oracle 10.2 or 11.1 client, connecting to Oracle 10.2 database. './configure' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-mysql=/usr/bin' '--enable-soap' '--with-curl' '--with-xmlrpc' '--enable-mbstring' '--with-openssl' '--enable-zip' '--with-ldap' '--with-oci8=/apps/oraoid/app/oraoid/product/11.1.0/client_1' Expected result: ---------------- When the database table sequence reaches double figures, the correct table (seed) id should be returned as a result of sql INSERT command and calling oci_bind_by_name. Actual result: -------------- The id returned is only the first digit of the real row id. -- Edit bug report at http://bugs.php.net/?id=48324&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48324&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48324&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48324&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48324&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48324&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48324&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48324&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48324&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48324&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48324&r=support Expected behavior: http://bugs.php.net/fix.php?id=48324&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48324&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48324&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48324&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48324&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48324&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48324&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48324&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48324&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48324&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48324&r=mysqlcfg