PhpStorm, XDebug and autoload

I'm trying to debug my scripts using Xdebug from PhpStorm, and I use autoload to load the files with the classes I use.

To do this, I have an .htaccess file at the root of my app with:

php_value auto_prepend_file "./include/autoload/autoload.php"


The file that the .htaccess prepends has this content:


require_once 'PEAR.php';

set_include_path(get_include_path().':./include');
set_include_path(get_include_path().":{$_SERVER['DOCUMENT_ROOT']}/libs/");
set_include_path(get_include_path().":{$_SERVER['DOCUMENT_ROOT']}/config/");
set_include_path(get_include_path().":{$_SERVER['DOCUMENT_ROOT']}/apps/cont/include/");

function __autoload($class) {
    $path = str_replace('_', '/', $class);
    require_once "$path.php";
}

function autoload($class) {
    $path = str_replace('_', '/', "$class.php");
    require_once $path;
}
spl_autoload_register('autoload');



The problem is that PhpStorm doesn't seem to take into account this file, and so, I get a "Fatal error: Class 'xxx' not found".
If I add an echo to this file, I don't get any output. So I guess, it's never appended.


Is this a bug? something that you guys plan to add at some point? am I missing something?



Thank you for your help.

3 comments
Comment actions Permalink

Hi there,

I doubt that it has anything to do with PhpStorm as all code is executed by PHP interpreter itself and PhpStorm only controls debugger (tells where to stop, displays variable value etc).

First of all -- how do you run/debug your script -- via browser or console (what Debug/Run Configuration do you use)?
* If 2nd -- then .htaccess obviously is not used.
* if 1st -- then apache is involved and that script should be executed anyway (so possibly you have apache/php misconfiguration here). Maybe (just maybe) you accessing the website via different URL and that autoloader file is not included by apache for some reason...

Are you able to debug the very simple scripts (like <?php $x = 13; echo $x; ) ?


P.S.
Some screenshots are always welcome.

0
Comment actions Permalink

Hello mr chocobo,

Andriy is absolutely right - execution of the script shouldn't to be affected by debugger. Please make sure that the problem don't appear when your script executed without debugger.

Do you still have the issue?

Thank you for feedback!

0
Comment actions Permalink

Andriy,

Thank you for your answers! It is hard to imagine a question about PhpStorm you cannot provide a competent answer for.:)

0

Please sign in to leave a comment.