Curious problem [message #172374] |
Mon, 14 February 2011 16:36 |
sheldonlg
Messages: 166 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
I am looking for a way to trace/show how php resolves method calls. I
don't know if this even exists. (I can't show the code as it exists
behind a firewall, but I can accurately describe the problem).
Class A has a require_once of class C.
Class B has a require_once of the same class C.
Class A invokes a method in class C in only one place. Before it calls
that method I have a debug print statement saying it is calling that method.
Class B invokes a method in class C in only one place. Before it calls
that method I have a debug print statement saying it is calling that method.
In Class C, in the method that is called, I put a debug print statement
saying it got there and is the first line in that method.
When I run the application that uses A, it says that it is calling the
method and also say that it got there.
When I run the application that uses B, it says that is calling the
method, but no echo of getting there appears.
No error messages appear in either case.
I can only assume that the method call is being resolved somewhere else,
somehow, in running application B because there is no error message of
not being able to resolve it, yet no echo appears of having gotten into
C. Yet, doing a grep over the entire codebase, I find only ONE place
where that method is defined and that is in class C.
So, I would like to know if there is a way to somehow trace this
application step by step or to print how it resolves the call. (How I
wish I had a php [command line] debugger now!)
These are not a web applications. They are invoked from the command line.
--
Shelly
|
|
|
Re: Curious problem [message #172376 is a reply to message #172374] |
Mon, 14 February 2011 17:29 |
sheldonlg
Messages: 166 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
Forget it. I found the problem. The parent class was calling a stub
that just returned true and that was the one that was being used to
resolve it. I must have missed seeing that with the grep.
On 2/14/2011 11:36 AM, sheldonlg wrote:
> I am looking for a way to trace/show how php resolves method calls. I
> don't know if this even exists. (I can't show the code as it exists
> behind a firewall, but I can accurately describe the problem).
>
> Class A has a require_once of class C.
> Class B has a require_once of the same class C.
>
> Class A invokes a method in class C in only one place. Before it calls
> that method I have a debug print statement saying it is calling that
> method.
>
> Class B invokes a method in class C in only one place. Before it calls
> that method I have a debug print statement saying it is calling that
> method.
>
> In Class C, in the method that is called, I put a debug print statement
> saying it got there and is the first line in that method.
>
> When I run the application that uses A, it says that it is calling the
> method and also say that it got there.
>
> When I run the application that uses B, it says that is calling the
> method, but no echo of getting there appears.
>
> No error messages appear in either case.
>
> I can only assume that the method call is being resolved somewhere else,
> somehow, in running application B because there is no error message of
> not being able to resolve it, yet no echo appears of having gotten into
> C. Yet, doing a grep over the entire codebase, I find only ONE place
> where that method is defined and that is in class C.
>
> So, I would like to know if there is a way to somehow trace this
> application step by step or to print how it resolves the call. (How I
> wish I had a php [command line] debugger now!)
>
> These are not a web applications. They are invoked from the command line.
>
--
Shelly
|
|
|