php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72160 isset() produces unexpected result
Submitted: 2016-05-04 20:12 UTC Modified: 2016-05-04 20:24 UTC
From: godmod at eqdkp-plus dot eu Assigned:
Status: Duplicate Package: Class/Object related
PHP Version: 7.0.6 OS: Linux
Private report: No CVE-ID: None
 [2016-05-04 20:12 UTC] godmod at eqdkp-plus dot eu
Description:
------------
In PHP < 7.0.6, the result for 

var_dump($this->user->style['template_path']);
var_dump(isset($this->user));
var_dump(isset($this->user->style));
var_dump(isset($this->user->style['template_path']));

is, as expected:

string(6) "modern"
bool(false) 
bool(true) 
bool(true)

But since the 7.0.6 release, it is not as expected, it is

string(6) "modern" 
bool(false) 
bool(false) 
bool(false)

Why does the isset() return false, for the exact same code?

Please note that $user is handled by __get() method


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-05-04 20:24 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2016-05-04 20:24 UTC] nikic@php.net
Duplicate of bug #72117. The behavior change you're seeing is caused by a number of bugs relating to missing __isset/offsetExists calls having been fixed. Presumably your $user object not only has a __get() method, but also an __isset() method, and that __isset() method is implemented incorrectly. In particular, it does not return true for __isset('style').
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 12:01:30 2024 UTC