/
[debugger] Supporting XDebug PHP extension

[debugger] Supporting XDebug PHP extension

Recently I needed to install ionCube Loader (see http://www.ioncube.com/loaders.php) into my development enviroment to be able to work on project, which code is encrypted using ionCube PHP Encoder (see http://www.ioncube.com/php_encoder.php). Unfortunately Zend Debugger extension I'm using every day for debugging code in my IDE rejected to work at same time, when ionCube Loader extension was loaded into PHP.

I have no doubts, that Zend Guard (see http://www.zend.com/en/products/guard/), which is alternative to ionCube PHP Encoder would have worked without any problems with Zend Debugger extension, since they are both produced by same company. But unfortunately the encrypted software had no version made using Zend Guard.

Looking for Zend Debugger alternatives I've found XDebug (see http://xdebug.org/). Basically XDebug offers same (if not much more) real-time debugging to PHP scripts plus it also enhances build-in PHP functions to allow displaying stack traces upon errors. It seems, though In-Portal don't know how to properly disable it's internal debugger in case if XDebug is being used instead of Zend Debugger. 

P.S.

Also XDebug is open-source and everyone can contribute code or report bugs/suggest features. Comparing to Zend Debugger, which is provided as-is and no bug reports are accepted, this is huge improvement. Actually I've been using XDebug since then and I'm pretty happy. My IDE (which is PHPStorm) integrates with both debuggers anyway.

Solution

It's really easy to fix though - check for XDEBUG_SESSION variable in user request.

Additionally following can be implemented to benefit from xDebug even more:

  1. set the "xdebug.file_link_format" setting via "ini_set" function call to link format used by In-Portal Debugger internally to make file links, that xDebug creates (e.g. in exceptions and notices) lead straight to PhpStorm
  2. rename the DBG_ZEND_PRESENT into DBG_IDE_PRESENT constant in /system/debug.php file and any places where it's used
  3. during debugger initialization, check for case, when DBG_ZEND_PRESENT constant is defined, but DBG_IDE_PRESENT constant is not and:
    • trigger a notice to the user, that he should be using DBG_IDE_PRESENT constant
    • define DBG_IDE_PRESENT constant on the fly with value from DBG_ZEND_PRESENT constant

Related Discussions

Related Tasks