Bug #71359 [NEW]: Coalescing operator on classes with overridden __get() method
From: kostasxx at gmail dot com
Operating system: Linux 4.1.13
PHP version: 7.0.2
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Coalescing operator on classes with overridden __get() method
Description:
------------
The issue appears when using the new null coalescing operator on object
parameters, when the defined class has override the magic __get() and an
error is triggered inside it.
The script runs the __get() method and not the __isset(), so the error
on __get() is triggered when the operator is used.
Test script:
---------------
http://www.pastebucket.com/97499
Expected result:
----------------
The expexted result should be not to trigger the error within the
__get() method
GET
string(6) "value1"
GET
string(7) "default"
Actual result:
--------------
The error is triggered
GET
string(6) "value1"
GET
PHP Notice: Property attribute2 does not exist in
/var/www/html/test.php on line 23
PHP Stack trace:
PHP 1. {main}() /var/www/html/test.php:0
PHP 2. Coalescing->__get() /var/www/html/test.php:41
PHP 3. trigger_error() /var/www/html/test.php:23
/var/www/html/test.php:41:
string(7) "default"
--
Edit bug report at https://bugs.php.net/bug.php?id=71359&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71359&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71359&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71359&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71359&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71359&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71359&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71359&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71359&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71359&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71359&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71359&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71359&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71359&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71359&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71359&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71359&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71359&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71359&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71359&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71359&r=mysqlcfg
Thread (15 messages)
- kostasxx at gmail dot com
- requinix@php.netBug #71359 [Opn->Ver]: Coalescing operator on classes with overridden __get() method
- nikic@php.netBug #71359 [Ver]: Coalescing operator on classes with overridden __get() method
- krakjoe@php.netBug #71359 [Ver->Csd]: Coalescing operator on classes with overridden __get() method
- arjen at react dot comBug #71359 [Com]: Coalescing operator on classes with overridden __get() method
- krakjoe@php.netBug #71359 [Csd]: Coalescing operator on classes with overridden __get() method
- arjen at react dot comBug #71359 [Com]: Coalescing operator on classes with overridden __get() method
- krakjoe@php.netBug #71359 [Csd]: Coalescing operator on classes with overridden __get() method
- frej dot akki at gmail dot comBug #71359 [Com]: Coalescing operator on classes with overridden __get() method
- krakjoe@php.netBug #71359 [Csd]: Coalescing operator on classes with overridden __get() method
- kostasxx at gmail dot comBug #71359 [Com]: Coalescing operator on classes with overridden __get() method
- krakjoe@php.netBug #71359 [Csd]: Coalescing operator on classes with overridden __get() method
- kostasxx at gmail dot comBug #71359 [Com]: Coalescing operator on classes with overridden __get() method
- krakjoe@php.netBug #71359 [Csd]: Coalescing operator on classes with overridden __get() method
- kostasxx at gmail dot comBug #71359 [Com]: Coalescing operator on classes with overridden __get() method