From:             jbeall at heraldic dot us
Operating system: Linux
PHP version:      5.0.0
PHP Bug Type:     Zend Engine 2 problem
Bug description:  __get and __set are not called when property explicitly defined 
public or var

Description:
------------
If you define a property as public, and then also define the __get() and
__set() functions within the same class, those functions are not called.

Reproduce code:
---------------
class Sub
{
        public $someProp;
        function __get($prop)
        {
                echo "Property $prop called\n";
        }

        function __set($prop, $val)
        {
                echo "Property $prop set to $val\n";
        }
}


$foo = new Sub();

$foo->someProp = 10;
echo $foo->someProp;

Expected result:
----------------
Property someProp set to 10
Property someProp called

Actual result:
--------------
10

-- 
Edit bug report at http://bugs.php.net/?id=29175&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29175&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29175&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29175&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29175&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29175&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29175&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29175&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29175&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29175&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29175&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29175&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29175&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29175&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29175&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29175&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29175&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29175&r=float

Reply via email to