The trouble with tracing is that sometimes you’re not allowed to use certain functions.
Fatal error: print_r(): Cannot use output buffering in output buffering display handlers in C:\apache\htdocs\act\wp-content\plugins\oik-bwtrace\includes\bwtrace.inc on line 253
I’m developing a website for a Golfing Society.
They want to be able to define and list their fixtures for 2014. But my shortcode is not producing results.
Originally published as the Top 10 list of questions to ask when some code doesn’t work here’s a list of questions applicable to PHP developers performing problem determination aka debugging.
Note that this list was originally written in the days before Stack Overflow, WordPress answers and the like.
Well… before I was aware of them.
- The person who’s trying to solve the problem is the asker
- Any person who has been cajoled into helping is the askee
- Any person who knows nothing about the problem can be the stupid question asker
- The person who knows all about the subject is the expert
- Finally there’s the project manager
If you don’t think you fall into any of the roles above then pick one at random.
- Go through the asker’s question list.
- Next try asking the askee.
- If you still haven’t found the source of the problem find the stupid question asker and start explaining the problem to them. You’ll probably realise your mistake quite quickly.
- If you can’t find a stupid question asker then take on that role yourself.
- Still no luck, then try the expert
- Whatever you do try to avoid the project manager
If you’re the asker
Ask the following:
- Has it ever worked?
- Did it actually work last time?
- What have you done?
- Did you actually change the program?
- Are you running the program you thought you’d changed?
- Are you looking at the right output?
- Have you changed the inputs?
- Does the code match the comments; if not, which is wrong?
- Is it repeatable; if not, give up until it is?
- Are you sure it’s not working?
You can ask these questions in whatever you order you feel necessary and as many times as you like until the problem is determined.
If you’re the askee
- Do the Google search that the asker should have done. Is this the modern day equivalent of RTFM?
- Ask the asker if they have reduced the problem to the simplest version that exhibits the bad behaviour.
- Ask the asker if they have compared the results with the most recent regression test.
- Ask them to repeat the problem on another machine.
If you’re the stupid question asker
Ask the asker
- Can you explain it to me again?
- Does it make any difference what day of the week you run it?
- Did you reload the data from yesterday’s dump?
- Does it work on Windows?
- Would you expect it to work when ‘whatever’ is not available?
- Were you logged in?
If you’re the expert
Have a brief look and either tell them the answer OR choose one of these
You’re doing it wrong
- It’s not possible
- I had that problem yesterday but it went away when I upgraded to version blah of thingummy
- It works fine on Windows
- You need to get trace output
If you’re the project manager
- When will you have a fix for it?
- If this went into production what severity would it be?
- Do you have a work around?
- Ask them if they have asked the expert.
This is a particularly good question if you know the asker IS the expert.
Using this shortcode you might expect the content of post 143, which is an
oik-plugins post_type to be displayed in all its splendour.
[bw_pages post_type=oik-plugins id=143 format=C]
Activate the smart-bbboing plugin to localize your website into the bbboing language.
Avaictte the smart-bbboing pliugn to lalcizoe yuor wbtesie itno the bbbniog lnaggaue
Depends on bbboing
That’s not the case. Compare with smart-bbboing
Earlier today I thought it would be an idea to
define( 'WP_DEBUG', true ); on this website.
I have a zero tolerance policy on Notify messages so I would be putting my money where my mouth is.
I was a bit concerned though, since it’s part of a WordPress Multisite installation. That means WP_DEBUG would be true for every site in the installation. Sure enough, my fears were well founded…