php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34620 Send an array to a class method change its value
Submitted: 2005-09-23 23:20 UTC Modified: 2005-09-24 00:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: andrea at 3site dot it Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.1.0RC1 OS: Windows XP SP2
Private report: No CVE-ID: None
 [2005-09-23 23:20 UTC] andrea at 3site dot it
Description:
------------
While I interact with another class and I call a method sending a run-time created array its values (integer value) is wrong.
This happen when I work with a lot of $_POST variables (I don't know if this is a problem but without this bug is absent ...)

Reproduce code:
---------------
// code ....
// NOTE: I develop with error_reporting E_ALL 
// and at this point is all OK

// die(print_r($artist_id, true));
// produce Array ( [0] => 1 [1] => image )

$GLOBALS['SES']->register('__artist_modify__', array($artist_id[0], $artist_id[1]));

// external class, that work without problems ...
// on $GLOBALS['SES'] register method
function register($name, $value) {
	die(print_r($value, true));
	// produce Array ( [0] => 86724468 [1] => image )
}

Expected result:
----------------
Expected ? ... I send an array with two keys ... so what's up ?

Actual result:
--------------
// this code works perfectly ... 
function accept($name, $value) {
	die(print_r($value, true));
}
$artist_id = array(1, 'image');
accept('__artist_modify__', array($artist_id[0], $artist_id[1]));

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-23 23:24 UTC] andrea at 3site dot it
P.S. ... with this code
$GLOBALS['SES']->register('__artist_modify__', array(''.$artist_id[0].'', $artist_id[1]));

it works as expected ... then maybe a trouble with an integer value ?
 [2005-09-23 23:27 UTC] tony2001@php.net
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 possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2005-09-24 00:15 UTC] andrea at 3site dot it
Hi tony, I am at 220 line of an administration area that has about 12 class files ... then it's not possible for me reproduce the error but if I pass a string error diseappear, then it's not a my own problem.
However, here is session class used: http://www.devpro.it/php4_id_94.html
Follow its link to look at PDO for PHP4 example (but PDO doesn't do anything different from all other pages).
Well , I pass a string, there are no problems, just an weisted hour to find the error that's of PHP and not mine.
Maybe I' ll try with a PHP4 version to know more, best regards.
 [2005-09-24 00:22 UTC] tony2001@php.net
Just stating that something is wrong doesn't help much.
Don't hesitate to reopen the report when you got a short & complete reproduce code.
Until then -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 14:01:34 2024 UTC