PEAR is archived and read-only

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

Home » Database » DB » Bug #6679

when object is defined connection to DB gives error

Details

Submitted2006-02-03 08:43 UTC
Fromedward at confirmat dot nl
Assigneddanielc
StatusWont fix
PackageDB
PHP Version4.4.2
OSlinux
Roadmaps(Not assigned)

Comments

[2006-02-03 08:43 UTC] edward at confirmat dot nl

Description:
------------
When $this->something is defined then call to DB::connect yields errors.

Has to do with $this being protected. Any other variable yields no errors.

Test script:
---------------
This program yield the errors:
<?php

require_once ('DB.php');

$this->a=3;

$loginquery = "SELECT user_ID FROM users WHERE user_name='blablabla'";

$hostname = "localhost";
$database = "database";
$username = "username";
$password = "password";
$dbasetype = "database";
$dsn = "$dbasetype://$username:$password@$hostname/$database";

$connection =& DB::connect($dsn);

/**
*
<br />
<b>Warning</b>: Problem with method call - please report this bug in <b>/srv/www/htdocs/login/examples/database_error.php</b> on line <b>16</b><br />
<br />
<b>Warning</b>: Problem with method call - please report this bug in <b>/usr/share/php/DB.php</b> on line <b>520</b><br />
<br />
<b>Warning</b>: Problem with method call - please report this bug in <b>/usr/share/php/DB.php</b> on line <b>557</b><br />

*/
?>

Expected result:
----------------
no error-messages. The potential bad use of $this has nothing to do with DB.

Anyway the $this->a gets defined just fine (as a StdClass) and is usable, so I would expect other functions to be able to deal with that.

Actual result:
--------------
<br />
<b>Warning</b>: Problem with method call - please report this bug in <b>/srv/www/htdocs/login/examples/database_error.php</b> on line <b>16</b><br />
<br />
<b>Warning</b>: Problem with method call - please report this bug in <b>/usr/share/php/DB.php</b> on line <b>520</b><br />
<br />
<b>Warning</b>: Problem with method call - please report this bug in <b>/usr/share/php/DB.php</b> on line <b>557</b><br />