Bug #80572 [Opn->Nab]: accessing array element that has an empty value does not work
| From: | girgias@php.net | Date: | Sat, 02 Jan 2021 13:33:23 +0000 |
| Subject: | Bug #80572 [Opn->Nab]: accessing array element that has an empty value does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231333@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80572&edit=1
ID: 80572
Updated by: girgias@php.net
Reported by: gkroll at keldine dot ca
Summary: accessing array element that has an empty value does
not work
-Status: Open
+Status: Not a bug
Type: Bug
Package: Session related
Operating System: all
PHP Version: 7.4.13
Block user comment: N
Private report: N
New Comment:
Cache issues aren't bugs indeed
Previous Comments:
------------------------------------------------------------------------
[2021-01-02 12:26:46] gkroll at keldine dot ca
Not a bug after all. The user that reported the problem to me cleared the cache, and the problem
went away.
Thank you for the link to the on-line shell where snippets of PHP code can be tested. I was not
aware that this very useful site existed.
Please close this report, or delete it, or whatever. Sorry to have wasted your time.
------------------------------------------------------------------------
[2021-01-01 21:11:28] dharman@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Please provide a reproducible example. You can use https://3v4l.org/
to make sure that the example does what you think it does. Once you have a reproducible example you
can share it with us and we will analyse it. For the moment, we have no way of identifying the
problem.
Things that you can look out for include OPCache for example. It is possible that you have
encountered a bug with OPCache, so try with OPCache disabled to see if it makes a difference. The
problem might not be in the code you are looking at right now.
You can also check against the latest snapshot of PHP 7.4 to see if the bug has been fixed in the
meantime. There is an RC for 7.4.14 available already.
I know that preparing a bug report might be a daunting task but we do appreciate your willingness to
help the PHP community.
------------------------------------------------------------------------
[2021-01-01 20:21:14] rtrtrtrtrt at dfdfdfdf dot dfd
seriously - the two code snippets have *nothing* in common!
if you can't write a reproducer it makes no sense to report a bug based on what someone else
said - that guy need to add at least var_dump() at the critical codepath so that you see if your
assumptions what's in the array are true
and i bet they aren't
------------------------------------------------------------------------
[2021-01-01 20:16:02] gkroll at keldine dot ca
I do not personally have access to PHP 7.4, but one of the users of the software I am trying to
support reports:
ERROR 8: Trying to access array offset on value of type bool
0 Error occurred on line 209 of file ancestry_ctrl.php in function print_child_ascendancy
1 called from line 209 of file ancestry_ctrl.php in function print_child_ascendancy
The line in question follows:
$this->print_child_ascendancy($parents["HUSB"], $sosa*2, $depth-1);
The array element $parents["HUSB"] is set here:
if ($ct>0) {
$parents["HUSB"]=$match[1];
} else {
$parents["HUSB"]="";
}
In this case, $ct is zero.
Note: The array $parents is passed as a normal (not by reference) argument to the function where the
error occurs. This may have something to do with the problem.
------------------------------------------------------------------------
[2021-01-01 20:03:51] rtrtrtrtrt at dfdfdfdf dot dfd35
besides the description is *not* session related you have for sure *not* posted the code throwing
the error and "ERROR 8" comes anyways from somewhere else
[user@localhost:/downloads]$ php -v
PHP 7.4.14 (cli) (built: Dec 17 2020 21:58:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
[user@localhost:/downloads]$ cat test.php
<?php declare(strict_types=1);
$xyz = array ('a'=>'value1', 'b'=>'',
'c'=>'value3');
var_dump ($xyz);
echo "\n";
if(isset($xyz['b']))
{
$foo = $xyz['b'];
}
$foo = $xyz['b'];
echo 'foo is set to:', $foo, ': end', "\n";
[user@localhost:/downloads]$ php test.php
array(3) {
["a"]=>
string(6) "value1"
["b"]=>
string(0) ""
["c"]=>
string(6) "value3"
}
foo is set to:: end
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=80572
--
Edit this bug report at https://bugs.php.net/bug.php?id=80572&edit=1