Freitag, 20. November 2015

[PHP+GDB] Debugging in PHP Part 2

I found a little thing called Pyclewn which is "A Vim front-end to the gdb and pdb debuggers." With a good configured Vim it is for me much easier and nicer to debug then with plain gdb.


Installing Pyclewn is easy. Doing the "Quick start" was enough on my machine: http://pyclewn.sourceforge.net/install.html

What you need to do is nearly the same as doing it in gdb. First you start Vim. In there you start Pyclewn with thing to debug, like so:
:Pyclewn gdb --args php5 -e soap_test_client.php
To start gdb use ':Cecho'. Or start the debug-run with ':Crun'. Or insert breakpoints or do other stuff. Afaik most gdb-commands are found prepending the C, like Cecho, Crun, Cbreak, etc.
For me the important commands were:
:Cbreak -- set a breakpoint
:Crun -- start running the program
:Ccontinue -- continue from the current point
:Cnext -- go to next line
:Cstep -- step inside current line
:Cfinish -- finish current function and return
:Ckill -- stop the running program
:Cinfo breakpoints -- show set breakpoints
:Clist *$pc -- show current line (line where program counter is)
:Cdelete -- delete all breakpoints
:Chelp -- get help
Pyclewn
Pyclewn stopped at breakpoint and printing content

And finally I also found the bug that was causing errors on loading my WSDL in PHP SOAP:
a / at the end of an URI
In the PHP source code in ext/soap/php_encoding.h are strings defined for namespaces, prefixes and so on. It seams that most of them I had done right. But this one little thing, the soap-http, I had a / at the URI and PHP just wanted the string without it.

#define WSDL_HTTP_TRANSPORT "http://schemas.xmlsoap.org/soap/http"
vs.
'soap-http': "http://schemas.xmlsoap.org/soap/http/"
 
Nice... 
So, if you're getting a SOAP-ERROR on parsing WSDL in PHP, be sure to check if the namespaces are the same.

Keine Kommentare:

Kommentar veröffentlichen

[Review/Critic] UDock X - 13,3" LapDock

The UDock X - 13.3" LapDock is a combination of touch display, keyboard, touch-pad and battery. It can be used as an extension of vari...