ID: 24499
Updated by: [EMAIL PROTECTED]
Reported By: wks at wks dot ch
Status: Open
-Bug Type: PostgreSQL related
+Bug Type: Documentation problem
Operating System: FreeBSD 4.5
PHP Version: 5.0.0b1 (beta1)
New Comment:
Make it a doc problem since you obviously didn't read the docs. And
close it since it's all your fault :-)
What you're missing....
class {
private $id;
function getId() {
$this->id = 1;
return $this->id;
}
}
Previous Comments:
------------------------------------------------------------------------
[2003-07-04 11:35:57] wks at wks dot ch
Description:
------------
In a class, if 'private' is used instead of 'var' for a variable
declaration then it fails with the Notice:
Undefined property: stdClassr'.
This still occurs if you make '$record = pg_fetch_object($q); return
$record->id;'
Reproduce code:
---------------
<?php
class Id
{
private $id;
// var $id;
public function getId()
{
$conn = pg_connect("dbname=db user=user
password=pwd");
$q = pg_query($conn, "SELECT id FROM id");
$id = pg_fetch_object($q);
return $id->id;
}
}
$id = new Id();
echo $id->getId();
?>
Expected result:
----------------
1
Actual result:
--------------
Notice: Undefined property: stdClass::$id in /path/id_test.php on line
11
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24499&edit=1
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php