Bug #66058 [NEW]: Add a new Array value makes a RECURSIVE Value
| From: | jkt at steampower dot hu | Date: | Fri, 08 Nov 2013 09:03:05 +0000 |
| Subject: | Bug #66058 [NEW]: Add a new Array value makes a RECURSIVE Value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-182656@lists.php.net to get a copy of this message | ||
From: jkt at steampower dot hu
Operating system: Windows XP SP3
PHP version: 5.4.21
Package: Arrays related
Bug Type: Bug
Bug description:Add a new Array value makes a RECURSIVE Value
Description:
------------
There is a short function, which starts one query and then parse the
results.
If the script goes to commented line, the $ret array new value makes a
recursive array.
I checked set the value by hand, like ='35';, but the PHP do the same.
I think it's a bug, because I downgrade the v5.3.27 and the script
functional normally again.
Test script:
---------------
$ret = Array();
$query = "SELECT * FROM any WHERE ID=".html2sql($ID).";";
$results = mysqli_query($connectedID, $query);
if (mysqli_num_rows($results)) {
$i = 0;
while ($row = mysqli_fetch_assoc($results)) {
$r[$i]['GyujtoEgysegID'] = $row['GyujtoEgysegID'];
$r[$i]['EgysegID'] = $row['EgysegID'];
$r[$i]['Jogosultsag'] = $row['Jogosultsag'];
$i++;
};
$j = 0;
foreach ($r as $d) {
if ($d['GyujtoEgysegID'] != '') {
$gye = GET_user_egysegGyujto($d['GyujtoEgysegID']);
foreach ($gye as $e) {
$ret[$j]['EgysegID'] = $e['EgysegID'];
$ret[$j]['Jogosultsag'] = $d['Jogosultsag'];
$j++;
};
}else {
$ret[$j]['EgysegID'] = $d['EgysegID']; // This is goes RECURSIVE
$ret[$j]['Jogosultsag'] = $d['Jogosultsag'];
$j++;
};
};
return $ret;
}else {
return false;
};
Expected result:
----------------
Something like this:
$ret = Array([0] => Array('EgysegID' => 2, 'Jogosultsag' => 1),
Array...
Actual result:
--------------
$ret = Array([0] => Array('EgysegID' => 2, 'Jogosultsag' => 1),
Array([1] => [1] => *RECURSIVE*
--
Edit bug report at https://bugs.php.net/bug.php?id=66058&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66058&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66058&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66058&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66058&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66058&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66058&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66058&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66058&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66058&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66058&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66058&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66058&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66058&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66058&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66058&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66058&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66058&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66058&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66058&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66058&r=mysqlcfg