Bug #79436 [NEW]: Declaring Array Index

From: Date: Mon, 30 Mar 2020 19:15:06 +0000
Subject: Bug #79436 [NEW]: Declaring Array Index
Groups: php.standards 
Request: Send a blank email to [email protected] to get a copy of this message
From:             schmidtzilla at outlook dot com
Operating system: LINUX cpanel
PHP version:      7.2.29
Package:          PHP Language Specification
Bug Type:         Bug
Bug description:Declaring Array Index

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 bug report at https://bugs.php.net/bug.php?id=79436&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=79436&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=79436&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=79436&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=79436&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=79436&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=79436&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=79436&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=79436&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=79436&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=79436&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79436&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=79436&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=79436&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=79436&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=79436&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=79436&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=79436&r=mysqlcfg


Thread (1 message)

  • schmidtzilla at outlook dot com
« previous php.standards (#1506) next »