[PHP-DEV] Bug #1277 Updated: OCIDefineByName() causes Apache crash From: Bug Database (php-dev <email protected>)
Date: 03/28/99

ID: 1277
User Update by: pumuckel <email protected>
Status: Open
Bug Type: Oracle related
Description: OCIDefineByName() causes Apache crash

[MODIFIED]

Apparently not OCIDefineByName causes the crash, but the OCIFetchRow() later on.

My table looks like:

CREATE TABLE TESTTABLE
(
        test1 VARCHAR(150) PRIMARY KEY,
        test2 VARCHAR(50),
        test3 VARCHAR(50),
        title VARCHAR(255),
        test4 VARCHAR(255),
        .....
)
TABLESPACE SPACE;

The statement is:
OCIParse($conn, "SELECT test1,test2,test3,TITLE FROM TESTTABLE WHERE TEST1 LIKE 'A%'");

Then I call following OCI methods:
OCIDefineByName($stmt, "TEST1", &$test1);
OCIDefineByName($stmt, "TEST2", &$test2);
OCIDefineByName($stmt, "TEST3", &$test3);
OCIDefineByName($stmt, "TITLE", &$title);
while(OCIFetchRow($stmt)) do_something();

If I leave LAST OciDefineByName in my source, php crashes. If I comment out last OCI command, the rest of php3 commands are executed successfully.

(I'm running Apache_1.3.4)

TRACKED DOWN LATER:
I've tracked down the problem with the php binary (without apache) and calling the same query again. This is what gdb tells me:

Program received signal SIGSEGV, Segmentation fault.
0x80814dc in oci8_fetch (statement=0x812ca20, nrows=1,
    func=0x80ba589 "OCIFetch") at functions/oci8.c:1112
1112 pval->value.str.val[ pval->value.str.len ] = 0;
(gdb) where
#0 0x80814dc in oci8_fetch (statement=0x812ca20, nrows=1,
    func=0x80ba589 "OCIFetch") at functions/oci8.c:1112
#1 0x8082b42 in php3_oci8_fetch (ht=0x8127fe8, return_value=0x80d07e8,
    list=0x80f92e0, plist=0x80f92a0) at functions/oci8.c:2108
#2 0x8051d3c in phpparse () at control_structures_inline.h:930
#3 0x805ba18 in php3_parse (yyin=0x81091c0) at main.c:1534
#4 0x805c117 in main (argc=2, argv=0xbffff86c) at main.c:1842
(gdb) print pval
$2 = (pval *) 0x812fad8
(gdb) print pval->value.str
$3 = {val = 0x80b3920 "", len = 0}
(gdb) print column->retcode
$4 = 1405
(gdb) print pval->value.str
$12 = {val = 0x80b3920 "", len = 0}

Full Bug description available at: http://ca.php.net/bugs.php3?id=1277

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>