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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
28 - 27 = ?
Subscribe to this entry?

 
 [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-2022 The PHP Group
All rights reserved.
Last updated: Fri Jan 21 03:03:34 2022 UTC