php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34000 parameters not passwed correctly
Submitted: 2005-08-05 00:10 UTC Modified: 2005-08-05 10:11 UTC
From: shim at andersens dot org Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.11 OS: FC3
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: shim at andersens dot org
New email:
PHP Version: OS:

 

 [2005-08-05 00:10 UTC] shim at andersens dot org
Description:
------------
Passing Parameters to a function result in all parameters and variables being set to the last paramter.

I'd like to submit a ziped of sample of code that does this, but I'm haven't been able to extract the broken code from my program yet.  It works sometimes, but not others.
Seems to depend on the number of classes I have included.

I'll update this when I have a working (broken) sample.

Reproduce code:
---------------
foo('a','b',c')

function foo( $a, $b, $c)
{
  echo $a;
  echo $b;
  echo $c;
  echo $d;  // new varible
}


Expected result:
----------------
abc

Actual result:
--------------
cccc

-- Notice $d is also set to 'c'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-05 00:16 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.

The code you have provided basically doesn't work (missing quotes and semicolons).
 [2005-08-05 00:27 UTC] shim at nadersens dot org
foo('a','b',c')
should be
foo('a','b','c')

also, are varibables are references to eachother. Changing one changes them all.
 [2005-08-05 00:35 UTC] tony2001@php.net
Your code works perfectly fine here.
Please provide the real one.
 [2005-08-05 00:53 UTC] shim at andersens dot org
Traced it down to a line that read
<?
function &Param($name)
{ 
  return @$this->params[$name];
}
?>

changing it to
...
$v = $this->params[$name];
return $v;
...

fixes it.  Is this the same issue fixed in 4.4?
 [2005-08-05 01:00 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Why didn't you try it before?
 [2005-08-05 01:09 UTC] shim at andersens dot org
I havent tried the CVS version because I dont have access to a dev server to compile the CVS version.  Sorry.
 [2005-08-05 10:11 UTC] sniper@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 03:01:28 2024 UTC