Re: [phplib] trouble with ct_sql/db_mysql.inc From: Fred Yankowski (fred <email protected>)
Date: 11/29/00

I recently found a problem in ct_sql.inc that might relate to your
problem. I have attached the message that I sent to this list on Nov 13.

-- 
Fred Yankowski           fred <email protected>      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA

-- Date: Mon, 13 Nov 2000 12:30:37 -0600 From: Fred Yankowski <fred <email protected>> To: phplib <email protected> Subject: db_mysql 'uninitialized array index (1)' error when starting new session

I just upgraded to phplib version 7.2c and now I'm seeing error messages like this when a session first starts up:

Warning: Uninitialized array index (1) in db_mysql.inc on line 228

It looks to me like the ac_store() method in CT_Sql is trying to read row data after a query without ever having done next_record() to get the row. Not only that, it's accessing the 1 column when (to my understanding) it should access the 0 column.

Here is a PHP3 file that demonstrates the problem. (The session class name is slightly different in my real test code):

-- <?php include("prepend.php3"); page_open(array("sess" => "Example_Session")); error_reporting(63); print("Hello"); page_close(); ?> --

And here is a patch that fixes the problem, in my configuration anyway:

*** ct_sql.inc 2000/11/13 16:08:18 1.1.1.2 --- ct_sql.inc 2000/11/13 18:26:29 1.2 *************** *** 110,116 **** if ( $this->db->affected_rows() == 0 && $this->db->query($squery) ! && $this->db->f(1) == 0 && !$this->db->query($iquery)) { $ret = false; --- 110,117 ---- if ( $this->db->affected_rows() == 0 && $this->db->query($squery) ! && $this->db->next_record() ! && $this->db->f(0) == 0 && !$this->db->query($iquery)) { $ret = false;

-- Fred Yankowski fred <email protected> tel: +1.630.879.1312 Principal Consultant www.OntoSys.com fax: +1.630.879.1370 OntoSys, Inc 38W242 Deerpath Rd, Batavia, IL 60510, USA

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>