Bug #72886 [Opn->Nab]: unset a property on object

From: Date: Thu, 18 Aug 2016 22:00:56 +0000
Subject: Bug #72886 [Opn->Nab]: unset a property on object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203385@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72886&edit=1 ID: 72886 Updated by: nikic@php.net Reported by: nikolaspinasco at gmail dot com Summary: unset a property on object -Status: Open +Status: Not a bug Type: Bug Package: Class/Object related Operating System: ubuntu PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Objects don't use by-value semantics. If you want to clone an object, use "$object2 = clone $object". Previous Comments: ------------------------------------------------------------------------ [2016-08-18 20:51:59] nikolaspinasco at gmail dot com Description: ------------ When I try unset() a property on object not instanced this remove a first proporty, please check the script. Test script: --------------- $object = new stdClass(); $object->test = '1'; $object->test_unset = '2'; var_dump($object); $object2 = $object; unset($object2->test_unset); var_dump($object); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72886&edit=1

« previous php.bugs (#203385) next »