ID: 25706
Updated by: [EMAIL PROTECTED]
Reported By: str at strgt dot cjb dot net
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Linux
PHP Version: Irrelevant
New Comment:
1. Too old PHP version (we're at 4.3.3 and about to release 4.3.4
already)
2. Most likely bug in the browser.
Previous Comments:
------------------------------------------------------------------------
[2003-09-30 14:46:29] str at strgt dot cjb dot net
Description:
------------
This is a weird bug, because I do only get it in some browsers.
It works fine in IExplorer, links, but not in Konqueror. All
browsers are "cookies enable". I have a class, with some
vars. When I use session_start in a class->function, i cannot
access $this nor $this->vars
I read some similar bugs are in php4.0 and solved in 4.1.0 and
I have 4.1.2
Reproduce code:
---------------
class PayUser {
var $pay_user, $passwd, $ses_id, $db, $new;
function PayUser($id) {
include_once("base.php"); // this is where i create $db
$this->db = $db;
$select = $this->db->exec("SELECT * from pay_users where
p_user='$id'"); // this means $this->db exists and it works
/// code omited..
}
function login($pass) {
// print_r($this) // before the session_start() prints me the
object
session_start();
print_r($this) /// after session_start() $this is not asigned
$sid = session_id();
$sql = "UPDATE pay_users SET ses_id='$sid' where
p_user='".$this->pay_user."'";
$this->db->exec($sql); // Fatal error: Call to a member function
on a non-object in this line... because $this does not exist
// more code omited
Expected result:
----------------
in the print($this) i should expect to print
payuser Object (
[db] => database Object (
[con] => adodb_postgres7 Object (
[databaseType] => postgres7
[hasLimit] => 1
[ansiOuter] => 1
[dataProvider] => postgres...
and the $this->db->exec($sql); should be executed, not to
give the Fatal error: Call to a member function on a non-object
in this line
Actual result:
--------------
the error... and the $this is lost...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25706&edit=1