Bug #70517 [Opn]: isset() on string produces invalid result
| From: | bwoebi@php.net | Date: | Sat, 19 Sep 2015 01:27:20 +0000 |
| Subject: | Bug #70517 [Opn]: isset() on string produces invalid result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196082@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70517&edit=1
ID: 70517
Updated by: bwoebi@php.net
Reported by: jens dot rosenthal at compcom dot de
Summary: isset() on string produces invalid result
Status: Open
Type: Bug
Package: Arrays related
PHP Version: 5.5.29
Block user comment: N
Private report: N
New Comment:
Just a quick note:
Works in PHP 7 as expected, PHP 5.5 won't be fixed though as sec only currently.
Previous Comments:
------------------------------------------------------------------------
[2015-09-17 08:52:56] jens dot rosenthal at compcom dot de
Description:
------------
Taking the example (#2) from the documentation page of the isset-function (Example #2 isset() on
String Offsets), and modifying the test to contain [0] references somewhere along the array path,
you can see, that each of these references provide a 'true' result, despite this is
clearly not correct (see attached script), since the first part of the array patch does not exist
(so any subsequent path cannot exist either).
Test script:
---------------
<?php
$expected_array_got_string = 'einstring';
var_dump(isset($expected_array_got_string['und']));
var_dump(isset($expected_array_got_string['und'][0]));
var_dump(isset($expected_array_got_string['und'][0]['test']));
var_dump(isset($expected_array_got_string['und']['test'][1]));
var_dump(isset($expected_array_got_string['und']['test'][0]));
?>
Expected result:
----------------
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Actual result:
--------------
bool(false)
bool(true)
bool(false)
bool(false)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70517&edit=1