[RndTbl] PHP method never returning?
Trevor Cordes
trevor at tecnopolis.ca
Wed May 30 01:41:40 CDT 2018
I'm debugging someone else's php code that is heavily OO.
They have an object, in it a method that calls another method on another
object. Pretty normal stuff:
class U_Controller extends Controller {
public function add_p($id) {
...
error_log("a");
$i->save();
error_log("b");
}
When it runs I get "a" in the logs, but *never* "b"!! I'm really stumped.
I'm pretty sure it's not calling exit() or die() or any other halting
statement as I put some hooks and debugs in and it's clearly exiting out
the bottom of the file as it should.
The save() call seems to complete ok as I've put debugs into it and I can
see it running and finishing. However, it is complicated by the fact that
this code is a nightmare and save() seems to re-call itself through
convoluted OO calls with cycles. But again, it all seems to exit out the
bottom as it should.
How can this possibly occur? What other way can a function or object skip
out of itself like that without running that log "b"?
Note: the above is actually in a try/catch block but I put debugs in the
catch and they don't seem to be running, so I don't think that's it
either?
It's like there's a "return2steps" or "call-this-method-again-and-ignore-
the-first-invocation" or something going on. Or I'm missing something
obvious because I never use OO/framework-heavy code like this.
(P.S. framework appears to be Bootstrap.)
More information about the Roundtable
mailing list