ID:               46570
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ms419 at freezone dot co dot uk
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Debian
 PHP Version:      5.2.6
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

This is because you are fetching $this->repository in __get(). This
calls __get() inside of __get(), which returns null.
Use $this->values[$name] instead in __get().


Previous Comments:
------------------------------------------------------------------------

[2008-11-14 01:53:18] ms419 at freezone dot co dot uk

Description:
------------
I have a class (in the reproduce code "Test") which is basically a
container for some attributes. Some of the attributes are the results of
expressions which I only want to evaluate when the attribute is accessed
for the first time. The __get() function seems perfect for this.

One attribute is "repository" - its value should be the result of an
expression, concatenated with a slash character and another attribute
("name"), if "name" is not null.

When "name" is not null, the first time "repository" is accessed,
__get() returns the result of the expression, without anything
concatenated. The second time "repository" is accessed, __get() returns
just a slash character and "name", without the result of the expression.

Reproduce code:
---------------
http://cgi.sfu.ca/~jdbates/tmp/php/200811130/test.phps

Expected result:
----------------
ket% php test.php                                                  
string(9) "some expr/name"
string(4) "some expr/name"
ket% 


Actual result:
--------------
ket% php test.php                                                  
string(9) "some expr"
string(4) "/name"
ket% 



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46570&edit=1

Reply via email to