PHP debugging with Zend Framework

hi,

I'm trying to get PHP debugging to work for a project that uses the Zend Framework. I installed and activated XDebug and the IDE is able to connect to the debugger, "Break on first line" works and when I set a breakpoint in the Framework's front controller, it works too. BUT I can't set breakpoints in my own controllers and views which makes the whole debugging of course pretty much useless. Just for testing purposes, I downloaded Eclipse PDT (yuck) and got the debugging running in less than 5 minutes and it also works in my own controllers and views (using XDebug, not the Zend Debugger). So I'm wondering... do you have any ideas what could be causing this and how I could fix it? Or is this maybe something that would have to be fixed on your side?

Thanks!

Carina





P.S.: I have loved Intellij Idea since the very first day I started using it for Java development. But adding JavaScript, then Flex and finally PHP support has made me even more happy, I am really grateful that I can finally use my favorite IDE for coding in all these languages, it makes my day a LOT less painful. I can't thank you enough! I keep annoying everyone who doesn't use it until they finally give it a try and they usually never switch back to whatever they had been using before.

12 comments

Hello Carina,

Thank you for your feedback,

Do you mean your breakpoints don't get hit, or they are not even accepted by debugger (breakpoint icon shows cross instead of 'check' mark)?

Besides, consider clearing the 'Stop session when the page is processed' run configuration option if the desired breakpoints are located in the PHP file different from the one that is initially opened in the browser when the configuration is started.

Regards,
Kirill

0

Hi Kirill,

the breakpoints contain a check mark but the debugger doesn't stop there.

It seems that the same problem was described here for an older version of Eclipse: http://bytes.com/topic/php/answers/798398-xdebug-xdebug-helper-zend-framework

2) If I have started a debug session from Eclipse I can step through
the bootstrapping fine up through the first dispatch event by the Zend
Framework front controller. After that all of my breakpoints are
ignored despite navigating into a controller/view. Does anyone have
any advice in terms of using XDebug with the Zend Framework? I thought
initially that my rewrite rule might be killing the XDebug session
somehow, but if its a cookie I find that rather hard to believe.


Since this works fine now in Eclipse, I was hoping that there was a way to fix this.

About the "stop session" checkbox: it is unchecked, but thanks for the hint. And the breakpoints in the front controller work fine before and after the code in my own controllers is called (there is also a redirect in between) so I assumed it has nothing to do with a lost session. I also tried setting the ide key manually to "IDEA1" in the xdebug config, assuming that maybe it was for some reason not accessible to the controllers if only passed in as a GET parameter but it (unsurprisingly) didn't help.


Some details: OS X 10.5, XAMPP 1.7.2a + bundled XDebug, Maia-10781


Regards,
Carina

0

Hello Carina,

Thanks for the details!

Seems like we need to look at the logs. Can you please do the following steps:

1. open <IDEA app>/bin/log.xml with a text editor
2. scroll to the bottom, add the following lines before <root> tag:

  <category name="com.jetbrains.php.debug">
    <priority value="DEBUG"/>
</category>


3. restart IDEA
4. do your PHP debugging steps including successful breaks at the front controllers

5. log file(s) are to be found at ~/Library/Caches/.IntelliJIdea90/log named idea.log, idea.log.1 etc.

Thanks,
Kirill

PS Please don't try to upgrage to IDEA EAP build 90.193: unfortunately it has PHP debugging broken on Mac : http://youtrack.jetbrains.net/issue/WI-480. Fix will be delivered with the next EAP.


0

Hi

thanks for the reply. I finally found a solution, so I'm sorry for stealing your time...

The problems seems to have been that although I had a local copy of the Zend framework in my project, the copy that came included in XAMPP was used. I didn't notice that before since I the files where being displayed while stepping through them and so I didn't have a look at the path of the files and assumed it was my local version of the Zend framework. After noticing this, I changed the pear.conf file to include my custom Zend installation (which is included in my Idea project) and now my breakpoints work also in my custom code.

So for me the problem is solved (and I can't tell you how happy I am about this), not sure if this is a bug in the PHP debugger or not. Thanks for your time (and for the PHP support in general! ).

Carina



P.S.: thanks for the warning about the update, that would have been the next thing I would have tried

0

Hello Carina,

Cool!

I think it's not the bug in PHP debugger, since (as I understood) you were setting your breakpoints in files different from those processed by the server.

Regards,
Kirill

0

No, I was setting the breakpoints in my own controllers, those are independent from the Zend Framework version that I'm using. And in both cases the debugger could step into the framework files but only in one case it could step into my custom controller files.

But even after fixing the error the problem occurred two more times, so maybe it's just a general instability issue. As long as I now know that it basically should work, I'm ok with that - it's a new feature after all.

Carina

0

Hello Carina,

If you can reproduce the problem logs are very welcome.

Regards,
Kirill

0

hi,


I think the error I'm experiencing now is a different one since it always happens when executing a certain action in my application and not when executing any of the other actions (whereas previous error also occurred for those other actions). This is the one I get now:
- in the UI I see the error message "connection error: invalid packet"
- the log file is attached, this is the most important part I guess:

2009-11-16 17:29:10,524 [ 476954]   WARN - rains.php.debug.dbgp.DbgpUtils - Packet is not valid org.jdom.input.JDOMParseException: Error on line 2: An invalid XML character (Unicode: 0x1a) was found in the value of attribute "name" and element is "property".      at org.jdom.input.SAXBuilder.build(SAXBuilder.java:504)      at org.jdom.input.SAXBuilder.build(SAXBuilder.java:888)      at com.intellij.openapi.util.JDOMUtil.loadDocument(JDOMUtil.java:301)      at com.jetbrains.php.debug.dbgp.DbgpUtils.readPacket(DbgpUtils.java:64)      at com.jetbrains.php.debug.dbgp.DbgpConnection$1.operate(DbgpConnection.java:79)      at com.jetbrains.php.debug.socketconnection.SocketConnection$1.run(SocketConnection.java:56)      at com.intellij.openapi.application.impl.ApplicationImpl$6.run(ApplicationImpl.java:1)      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)      at java.util.concurrent.FutureTask.run(FutureTask.java:123)      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)      at java.lang.Thread.run(Thread.java:613)      at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:9)



I don't know which "name" and "property" the error message is referring to and how to influence or inspect them.


When I execute the same action and try to debug in Eclipse, it works just fine - which seems a little weird because they are both using the same XDebug version (when I change the debugger port, Eclipse can't debug anymore so I'm rather sure that it is indeed using this configuration):


[XDebug]
zend_extension="/Applications/XAMPP/xamppfiles/lib/php/php-5.3.0/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_port=9000
xdebug.remote_autostart=true
xdebug.remote_log=xdebuglog.log





Carina



Attachment(s):
idea.log.zip
0

Hello Carina,

IDEA is expecting to receive a valid XML message from XDebug, but seems to get a malformed one ("invalid packet"). To my regret we don't put the contents of this packet to the log (will fix that), but XDebug log should contain it. Path to xdebug log is indeed what you've configure with

[XDebug]
...
xdebug.remote_log=xdebuglog.log

Can you please attach this one too?

Thanks,
Kirill

0

hi,

here it is. Deleted the old log and executed a request that caused an error so if there is anything to see, it should be there.

Carina



Attachment(s):
xdebug.log.zip
0

Hello Carina,

Up to the moment, the origin of illegal character in XML message coming from XDebug is still not clear.

Nevertheless we've added a patch to handle such an input, along with some more detailed logging. Please check with the next EAP. We may also need new IDEA logs for a deeper look.

Thanks,
Kirill

0

Please sign in to leave a comment.