Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello Newsgroup,

I'm attempting to try some stuff in PHP 4.3.2   (Old.. old version)

Basically I have something like this:

class MyClass {
    function someMethod($a,$b){
        echo "[$a, $b]";
    function foot() {
        // someMethod sees "Dog","Dog" ?????????????
        $file = $this->filename();

html stuff.... this gets included from the foot() method.
<?php $this->foot(); ?>

In the above code, both $a AND $b are set to "Dog".

If I have:

someMethod($a, $b = FALSE) { }

Both $a and $b are FALSE.

The above works fine in PHP 5.n but NOT earlier versions.

I've tried other methods, sometimes they work, sometimes not
with seemingly little rhyme nor reason.

What functions, if any, are causing $a and $b to BOTH be set
to "Dog" ???

-- Custom web programming
guhzo_42@lnubb.pbz (rot13)                User Management Solutions

Re: Argument

Quoted text here. Click to load it

It's a mystery to be sure. I would say that the someMethod("Cat","Dog")
is not called if you are not getting the output "[Cat, Dog]". Also I
think that the script would produce infinate output since foot()
includes a file that calls foot() and you get stuck in a loop.

Is this the actual code you are using, or have you tried to make it
simpler so that it's more easily understood?

Re: Argument

Quoted text here. Click to load it

I tried to simplify it. (I think I screwed up in the example, as it
was NOT caught in a loop, in a nutshell, I had:  

class MyClass {
    function display(){
    function foot(){

I tried to reproduce it using a few test files and wasn't able to.

where some_file.php accesses '$this->foot()' and foot() in turn
access some stuff using vsprintf() among other things.

I "fixed" the problem by removing some code in another area that
was using references.. (Oh how I miss perl's $var syntax..)  

I had: 'function &getParam($name);' that returned a reference
to an array element.  

Anyhow, converting a method that was returning a reference to  
a method that returns by-value (and just accessing the variables
directly when I want a reference) solved it. Albeit in a way  
that I didn't want.

I now have "function getParam($name)" it works. Still, it bugs me
that I don't know why the call stack got messed up.

-- Custom web programming
guhzo_42@lnubb.pbz (rot13)                User Management Solutions

Site Timeline