ID:               40402
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jpieper at intergenia dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Irrelevant
 PHP Version:      5.2.1RC4
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php




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

[2007-02-08 12:53:02] jpieper at intergenia dot de

Description:
------------
After typecasting an object to an array you can iterate over the
properties and manipulate private/protected properties.

Reproduce code:
---------------
<?php

class Foobar {
    private $oObject;
    public function __construct() {
        $this->oObject = new stdClass;
    }
}

$oFoobar = new Foobar;
$aProperties = (array)$oFoobar;
foreach ($aProperties as $mProperty) {
    if (is_object($mProperty) && ($mProperty instanceof stdClass)) {
        $mProperty->blaaa = 'fooo';
    }
}
var_dump($oFoobar);

?>

Expected result:
----------------
error because you must not access and rewrite/manipulate
private/protected properties.

Actual result:
--------------
object(Foobar)#1 (1) {
  ["oObject:private"]=>
  object(stdClass)#2 (1) {
    ["blaaa"]=>
    string(4) "fooo"
  }
}


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


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

Reply via email to