|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60067 Strange Recursive/interation
Submitted: 2011-10-15 19:39 UTC Modified: 2015-06-14 04:22 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: bigorangemachine at hotmail dot com Assigned: cmb (profile)
Status: No Feedback Package: Variables related
PHP Version: 5.3.8 OS: Linux CGI/FastCGI
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-10-15 19:39 UTC] bigorangemachine at hotmail dot com
I wrote an OOP PHP class to interact with an Shipping estimate API.  I setup a logging system to help log & track any issues during testing.

The goal was to have this logging system remove certain index keys for both 'objects' and 'arrays' in a recursive manor.

I believe that the passed-reference (variable using with an ampersand or what I call a 'live link') is being 'pushed' up.

When I check the logged xml (in the example) it often read 'omitted'.  The variable was being changed even though the original call to function wasn't done using a passed-reference.

The function would work correctly with the corrected code or the log_xml calls completed first.  Maybe using $v is what broke the pass reference and it was just a 'copy' after that.

Test script:
Code Sample Here


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-16 01:15 UTC] anonymous at anonymous dot anonymous
Needs an SSCCE:
 [2011-10-16 02:12 UTC] bigorangemachine at hotmail dot com
FROM (corrected):
				}else if($_type=='array'){
				if(gettype($v)=='object' && ($v instanceof Traversable)){//
				else if(gettype($v)=='array'){
TO (shortened):

I changed using $obj[$k] ( and $obj->{$k} [sorry for the syntax error]) to just using $v in the function log_clean().  This is my first bug report.  Sorry if I don't have the format correct.
 [2015-06-05 17:20 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2015-06-05 17:20 UTC]
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.

To clarify: we do not need a script that works, but rather a script that allows us to reproduce the bug – ideally by simply executing this script, what implies that the script is self-contained.
 [2015-06-14 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 12:03:36 2021 UTC