Bug #77291 [Opn->Fbk]: __isset() magic method doesn't work if implemented via a trait.
| From: | danack@php.net | Date: | Thu, 13 Dec 2018 09:31:04 +0000 |
| Subject: | Bug #77291 [Opn->Fbk]: __isset() magic method doesn't work if implemented via a trait. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218429@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77291&edit=1
ID: 77291
Updated by: danack@php.net
Reported by: tandrewbennett at hotmail dot com
Summary: __isset() magic method doesn't work if implemented
via a trait.
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Ubuntu 16.04
PHP Version: 7.3.0
Block user comment: N
Private report: N
New Comment:
This appears to work for me on PHP 7.3.0 https://3v4l.org/i9Lpv
Please can you try with OPCache disabled, and/or disabling any non-core extensions you have enabled?
Previous Comments:
------------------------------------------------------------------------
[2018-12-13 07:10:11] tandrewbennett at hotmail dot com
Description:
------------
The __isset() magic method is no longer invoked on a class if implemented via a Trait.
Test script:
---------------
trait AccessibleProperties
{
public function __isset($property)
{
return property_exists($this, $property);
}
public function __get($property)
{
if (property_exists($this, $property)) {
return $this->$property;
}
}
}
class Foo {
use AccessibleProperties;
protected $a = 'Some value';
}
$foo = new Foo;
$foo->a; // this works: returns 'Some value'
isset($foo->a); // this doesn't work: returns false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77291&edit=1