PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #1632

mysql DB err (call from DB_DataObject)

Details

Submitted2004-06-14 09:05 UTC
Fromdgu4 at hotmail dot com
StatusBogus
PackageDB_DataObject
PHP Version5.0.0RC3 (Release Candidate 3)
OSfedoracore1
Roadmaps(Not assigned)

Comments

[2004-06-14 09:05 UTC] dgu4 at hotmail dot com

Description:
------------

hi, got this failure when using DB_DataObject / DB
mysql fails

#!/usr/bin/php -q DB_DataObject_Generator: 0: CREATING FOR testdb
Notice: Trying to get property of non-object in /opt/builds/php-5.0.0RC3/lib/php/DB/mysql.php on line 800
[DB_Error: message="DB Error: insufficient data supplied" code=-20 mode=return level=notice prefix="" info="SHOW TABLES [nativecode=0 **]"]

Reproduce code:
---------------
# caller code

$_SERVER['argv'][1] = 'example.ini';
require_once 'DB/DataObject/createTables.php';

#

; Example INI File
[DB]
;portability = 15
; if you are working with oracle (or plan to) - this will do things
; like force lowercase table names (see the PEAR DB manual

[DB_DataObject]
database = mysql://user:blabla@localhost/testdb
schema_location = /opt/data/www/12020_dgphoto/tmpdb
class_location = /opt/data/www/12020_dgphoto/tmpdb
require_prefix = DataObjects/
class_prefix = DataObjects_

Expected result:
----------------
php 4.3.4 same code produce correct results.

#!/usr/bin/php -q db_dataobject_generator: 0: CREATING FOR testdb
db_dataobject_generator: 0: calling generatedefinitions
db_dataobject_generator: 0: Generating Definitions file:
db_dataobject_generator: 0: Writing ini as /opt/data/www/12020_dgphoto/tmpdb/testdb.ini
db_dataobject_generator: 0: calling generateclasses
db_dataobject_generator: 0: writing DataObjects_Person
db_dataobject_generator: 0: DONE

[2004-06-18 06:53 UTC] dgu4 at hotmail dot com

>what happens when you log in as the same user to the mysql command line tool - and run SHOW TABLES

mysql show table as same user logged in is OK, this user is all privileges granted on this database (tried as root too, and got same error). Same script called from php4 with same user is OK.

// content of line#800 for mysql.php (seems the latest from cvs)

if (isset($result->result)) {
/*
* Probably received a result object.
* Extract the result resource identifier.
*/
$id = $result->result;
$got_string = false;
} elseif (is_string($result)) {
...

[2004-06-27 19:59 UTC] dgu4 at hotmail dot com

mysql is exactly the same from cvs, i compared both

//a try to help, debugging:
if (isset($result->result)) {
// @ this point, $result == name of the table >as string<
// var_dump($result) = string(3) "alb"
// $result->result is nothing as you can see and we never had to be there
/*
that's otherwhere, something like a "string overide" that catch all ->get() and returns a true value for isset.
and we never reach that line :
*/
} elseif (is_string($result)) {

Y/Dgu4

Installed packages:
===================
Package Version State
Archive_Tar 1.2 stable
Config 1.10.2 stable
Console_Getopt 1.2 stable
DB 1.6.4 stable
DB_DataObject 1.6.1 stable
Date 1.4.3 stable
HTML_Template_IT 1.1 stable
LiveUser 0.12.0.20040617 beta
PEAR 1.3.2 stable
XML_Parser 1.2.0 stable
XML_RPC 1.1.0 stable
XML_Tree 1.1 stable
XML_Util 0.6.0 stable

[2004-07-02 14:15 UTC] dgu4 at hotmail dot com

got no access to a "-r" from command line,
from php script:
$x = "abc"; var_dump(isset($x->result));

outputs:
bool(true)

Yann

[2004-07-08 06:47 UTC] dgu4 at hotmail dot com

>Can you download a snapshot of PHP5 - and do the same test.
>if you get (true) - file it as a bug on bugs.php.net

This was a php Bug !
it works now with a snapshot downloaded yesterday ( july 07th )

[2005-01-12 11:18 UTC] fehrp at ee dot ethz dot ch

hi
Could you point out, where you placed that bug on bugs.php.net ?

I think they made it regressive in 5.0.3 again, because I encounter exactly the same problem now (it works with 5.0.0)

cheers
patrick