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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: godmod at eqdkp-plus dot eu
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 16:03:34 2021 UTC