php debugging: how to debug SMF and/or your mods ?

Started by aegersz, October 19, 2016, 06:06:41 AM

Previous topic - Next topic

aegersz

i'm having trouble with a mod that works but not properly. it throws no errors.
hi guys, i'd like your help with this please. i have used some basic php debugging techniques like echo'<pre>';var_dump($var);die; and have used debug_print_backtrace(); and have configured php.ini to log etc.

all the variables i inspected seem correct ... so i ask these 3 questions.

1. what do you guys use to debug your mods OR even SMF itself ?

2. ideally, i'd like to step through the code line-by-line and inspect everything after each statment - is that sort of debugger available and free ? OR are there other ways to achieve almost the same thing ?

3. do all php debugging tools run on the server (i guess most would) ?
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Arantor

I used the var_dump method even when developing 2.1 itself.

aegersz

ok then but how do i go about seeing the results from a SQL call like $request = $smcFunc['db_query'] ... etc. ?

i'd like to see what data the query returns, assuming that it executes without error; i'm struggling to see how and where the returned data is processed further after the query finishes.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Arantor

It's processed by calls to db_fetch_row and db_fetch_assoc, MySQL results are handled one row at a time.

aegersz

#4
got it but have hit a wall because all my checks show the results that i would expect.

thanks for your help ... i will wait for the mod author to check his code then - he expects multiple rows to return from his query but he only gets 1 back - so he needs to rework his SQL, i can only assume.

but i learned something so it was worthwhile
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

4Kstore


¡¡NEW MOD: Sparkles User Names!!!

aegersz

thanks; i have debugging on always in my test system, I check my logs often and my live system has a tiny load.

but I can't resist another handy mod !
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Pipke

Edit Settings.php and add to the end (before ?>)
$db_show_debug = true;
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

aegersz

I use http://custom.simplemachines.org/mods/index.php?mod=1466 to change that setting plus it shows a bunch of information at the bottom of the page.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

4Kstore

Yes, it great for debug and improve the performance

¡¡NEW MOD: Sparkles User Names!!!

Arantor

All that mod does is enable a feature already in SMF, you could enable it with a single line of code in Settings.php, but yes, that one really helps.

albertlast

The best way in my eyes to use xdebug,
than you can use the debug tool of your ide.

you can stop on specific line look at vars and many more things.

Advertisement: