php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19948 Broken Function mybe segfault releated
Submitted: 2002-10-17 03:45 UTC Modified: 2002-10-21 06:00 UTC
From: lussnig at smcc dot net Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.3.0-pre1 OS: Linux 2.4.19
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lussnig at smcc dot net
New email:
PHP Version: OS:

 

 [2002-10-17 03:45 UTC] lussnig at smcc dot net
The OCI Function "OCIDefineByName" in combination with "OCIFetch" do not fill the defined Variable. If the variable
bevore was set it is cleared (unset) after the OCIFetch call.

Since it worked bevore an if i repleace the libphp4.so with 4.2.3 it work again it is no script fault. And it is reproductable.

Configure for both version's 4.2.3 and 4.3.0-pre1 are the same. CVS from last week also do not work.

 './configure' '--prefix=/opt/php4' '--exec-prefix=/opt/php4' '--with-apxs2=/opt/httpd/bin/apxs' '--with-zlib' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--enable-ftp' '--with-gd' '--with-imap' '--with-ldap=/opt/openldap' '--with-mysql=/opt/mysql' '--enable-sockets' '--enable-yp' '--with-gettext' '--with-imap-ssl' '--with-png-dir=/opt/libpng' '--with-jpeg-dir=/opt/jpeg' '--with-freetype-dir=/opt/freetype' '--with-t1lib' '--enable-gd-native-ttf' '--with-ttf' '--enable-tokenizer' '--enable-sysvshm' '--enable-sysvsem' '--with-oci8=/opt/oracle/product/8.1.7' '--enable-sigchild'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-17 04:58 UTC] lussnig at smcc dot net
Here is the DIFF between working version and brocken version. Maybe this could help to fix the buf

Index: oci8.c
===================================================================
RCS file: /repository/php4/ext/oci8/oci8.c,v
retrieving revision 1.177
diff -r1.177 oci8.c
1247c1247
<       if ((! statement->has_data) || (column->indicator == -1)) { /* column is NULL or statment has no current data */
---
>       if (column->indicator == -1) { /* column is NULL */
1395d1394
< 
1397d1395
<       statement->has_data = 0;
1673,1680c1671
<                                       if ((outcol->data_type == SQLT_DAT) || (outcol->data_type == SQLT_NUM)
< #ifdef SQLT_TIMESTAMP
<                                               || (outcol->data_type == SQLT_TIMESTAMP)
< #endif
< #ifdef SQLT_TIMESTAMP_TZ
<                                               || (outcol->data_type == SQLT_TIMESTAMP_TZ)
< #endif
<                                          ) {
---
>                                       if ((outcol->data_type == SQLT_DAT) || (outcol->data_type == SQLT_NUM)) {
1781d1771
<               statement->has_data = 0;
1841,1842d1830
<               statement->has_data = 1;
< 
1849,1850d1836
<       statement->has_data = 0;
< 
3745,3754d3730
< #ifdef SQLT_TIMESTAMP
<               case SQLT_TIMESTAMP:
<                       RETVAL_STRING("TIMESTAMP",1);
<                       break;
< #endif
< #ifdef SQLT_TIMESTAMP_TZ
<               case SQLT_TIMESTAMP_TZ:
<                       RETVAL_STRING("TIMESTAMP_TZ",1);
<                       break;
< #endif
4254,4255c4230,4231
<       text errbuf[512];
<       sb4 errcode = 0;
---
>     text errbuf[512];
>     sb4 errcode = 0;
4258,4261d4233
< #ifdef HAVE_OCI8_ATTR_STATEMENT
<       ub2 errorofs = 0;
<       text *sqltext = NULL;
< #endif
4268,4286d4239
< 
< #ifdef HAVE_OCI8_ATTR_STATEMENT
<                       CALL_OCI_RETURN(statement->error, OCIAttrGet(
<                               (dvoid *)statement->pStmt,
<                               OCI_HTYPE_STMT,
<                               (text *) &sqltext,
<                               (ub4 *)0,
<                               OCI_ATTR_STATEMENT,
<                               statement->pError));
< 
<                       CALL_OCI_RETURN(statement->error, OCIAttrGet(
<                               (dvoid *)statement->pStmt,
<                               OCI_HTYPE_STMT,
<                               (ub2 *)&errorofs,
<                               (ub4 *)0,
<                               OCI_ATTR_PARSE_ERROR_OFFSET,
<                               statement->pError));
< #endif
< 
4321,4324d4273
< #ifdef HAVE_OCI8_ATTR_STATEMENT
<               add_assoc_long(return_value, "offset", errorofs);
<               add_assoc_string(return_value, "sqltext", sqltext ? (char *) sqltext : "", 1);
< #endif
Index: php_oci8.h
===================================================================
RCS file: /repository/php4/ext/oci8/php_oci8.h,v
retrieving revision 1.24
diff -r1.24 php_oci8.h
122d121
<       int has_data;
 [2002-10-17 07:42 UTC] michael dot mauch at gmx dot de
Example to reproduce, copied from the manual:

<?php
/* OCIDefineByPos example thies@thieso.net (980219) */

$conn = OCILogon("scott","tiger");

$stmt = OCIParse($conn,"select empno, ename from emp");

/* the define MUST be done BEFORE ociexecute! */

OCIDefineByName($stmt,"EMPNO",&$empno);
OCIDefineByName($stmt,"ENAME",&$ename);

OCIExecute($stmt);

while (OCIFetch($stmt)) {
    echo "empno:".$empno."\n";
    echo "ename:".$ename."\n";
}

OCIFreeStatement($stmt);
OCILogoff($conn);
?>

The first result row is empty, subsequent ones are ok.
 [2002-10-21 06:00 UTC] thies@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Sep 29 08:03:43 2022 UTC