Bug #79436 [Opn->Nab]: Declaring Array Index
| From: | requinix@php.net | Date: | Mon, 30 Mar 2020 19:19:53 +0000 |
| Subject: | Bug #79436 [Opn->Nab]: Declaring Array Index | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226350@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79436&edit=1
ID: 79436
Updated by: requinix@php.net
Reported by: schmidtzilla at outlook dot com
Summary: Declaring Array Index
-Status: Open
+Status: Not a bug
Type: Bug
-Package: PHP Language Specification
+Package: *General Issues
Operating System: LINUX cpanel
PHP Version: 7.2.29
Block user comment: N
Private report: N
New Comment:
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.
https://3v4l.org/kDjTA
Previous Comments:
------------------------------------------------------------------------
[2020-03-30 19:15:05] schmidtzilla at outlook dot com
Description:
------------
$round = [
'round' => empty($current) ? 1 : $current['round'] + 3,
'type' => 'Public',
'starts' => empty($current) ? $_SERVER['REQUEST_TIME'] :
floor($_SERVER['REQUEST_TIME'] / 86400) * 86400 + 72000,
'ends' => floor($_SERVER['REQUEST_TIME'] / 86400) * 86400 + 72000 + 864000,
'speed' => 25,
'build' => 2500,
'credits' => 4294967295,
'jackpot' => 100
];
lLater on in code..
$round = [
'round' => $current['round'] + 1,
'type' => 'Speed',
'starts' => floor($_SERVER['REQUEST_TIME'] / 86400) * 86400 + 72000,
'ends' => floor($_SERVER['REQUEST_TIME'] / 86400) * 86400 + 72000 + 172800,
'speed' => 100,
'build' => 2500,
'credits' => 0,
'jackpot' => 50
];
If the same variable is already assigned with different values 'type' =>
'Speed' now equals 25 because it's now assuming I am calling onto the variable
$round['speed'] instead of wanting the string 'Speed' and inputs it into its
place.
Expected result:
----------------
I expect the $round = [ 'type' => 'Speed' ] to put the string Speed into the
index 'type' of the $round variable instead of the value of $round['speed']
Actual result:
--------------
$round['type] = 25;
instead of
$round['type'] = 'Speed';
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79436&edit=1