Project Zero: FirePHP running under P8’s PHP Runtime
outubro 19th, 2008 | by Aldrin Leal |Update: No Longer Important. The bug has been vanished for FirePHPCore-0.2.0 onwards, and now there’s even a version from IBM itself. Thank you, folks!
(Tested under M2. YMMV)
What is it?
If you know what I am trying to do, please skip to the next section. Otherwise, keep on reading.
Project Zero:
Lets quote Wikipedia, shall we?
WebSphere sMash is a development and runtime environment from IBM for the creation of dynamic web applications using the scripting languages Groovy and PHP. It contains a PHP runtime written in Java. Project Zero is the experimental software development community in which new versions of WebSphere sMash are incubated.
WebSphere Smash integrates with Eclipse and produces REST-style services on top of Groovy or PHP.
P8:
As you might have guesses, Zero runs under a Java virtual machine, so it needs one interpreter in order to execute PHP. This interpreter is called P8.
FirePHP:
FirePHP is an extension for Firefox’s FireBug Plug-in which lets you use Firebug for logging messages, as well as variable dumps from PHP statements into Firefox’s Console Window. It works by writing the output results as HTTP Headers in the Request Response:
In truth, FirePHP is language-agnostic. All it needs is the headers, which should be set according to a given protocol.
However, when running under P8, it is not going to work, for those reasons:
- Due to not having support for the headers_sent with arguments, the logging is not going to work;
- The result http results are incorrectly formatted. This is due to issue 3160, which is about PHP’s microtime.
In a nutshell: How to get FirePHP running under Project Zero?
Patch it. Here is the diff (for version 0.1.2). To sum up: Now I am using an static counter and there is an ‘if’ for Zero which does in a fashion similar to what the protocol expects.
Also, remember to either call ob_start at the very start of your .php file, or define buffering on php.ini under conf/.
Anything else?
Yes. dump is not working, but I still have to check that. :)
You must be logged in to post a comment.