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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 11:01:33 2024 UTC