#19948 [Com]: Broken Function mybe segfault releated
| From: | michael dot mauch at gmx dot de | Date: | Thu, 17 Oct 2002 12:42:37 +0000 |
| Subject: | #19948 [Com]: Broken Function mybe segfault releated | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-22656@lists.php.net to get a copy of this message | ||
ID: 19948
Comment by: michael.mauch@gmx.de
Reported By: lussnig@smcc.net
Status: Open
Bug Type: OCI8 related
Operating System: Linux 2.4.19
PHP Version: 4.3.0-pre1
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2002-10-17 04:58:08] lussnig@smcc.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 03:45:03] lussnig@smcc.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'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19948&edit=1