php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21396 after $var =pack(...) with 'N' flag, if use $var in $tmp[$var]='v' key is empty
Submitted: 2003-01-03 14:24 UTC Modified: 2003-01-04 06:18 UTC
From: slach at ems dot ru Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.2.3 OS: w2k, linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: slach at ems dot ru
New email:
PHP Version: OS:

 

 [2003-01-03 14:24 UTC] slach at ems dot ru
just see code
<?
error_reporting(E_ALL);

$aa = pack("N",127);
$bb = pack("N",65);
$cc = pack("N",121344231);

echo "$aa\n";
echo "$bb\n";
echo "$cc\n";

$tmp=array();

$tmp[$aa] = "aa";
$tmp[$bb] = "bb";
$tmp[$cc] = "cc";

var_dump($tmp);
?>

output:

A
;??
array(3) {
  [""]=>
  string(2) "aa"
^^^^^^^ but needed [""] => "aa" ???
  [""]=>
  string(2) "bb"
  [";??"]=>
  string(2) "cc"
}

WHY ?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-04 06:18 UTC] sniper@php.net
RTFM: http://www.php.net/manual/en/language.types.array.php

"A key is either an integer or a string"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 12:01:30 2024 UTC