Welcome to WebmasterWorld Guest from 54.196.208.6

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

What am I missing?

Nothing shows, not even error messages.

     
9:32 pm on Aug 9, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


I'm working on a largish piece of code and all I get in the browser is a blank screen.

I added
error_reporting(E_ALL);
ini_set('display_errors', '1');

but I still get no output and no errors.

If I write one line of code with a deliberate error, I see a message about syntax errors.

As soon as I add some of the functions from the new long code, I just get a blank screen.

How to find the syntax errors when there's no output and no error messages?

Even "print"ing variables and using "var dump" shows nothing (unless it's on the very simple one or two line test code).
11:40 pm on Aug 9, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 7, 2003
posts:4783
votes: 0


Any calls to ob_start ?

Ref: [php.net...]
11:55 pm on Aug 9, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


No. This is just a few functions with preg_match, str_replace and preg_replace and a few arrays.
12:15 am on Aug 10, 2012 (gmt 0)

Moderator from GB 

WebmasterWorld Administrator brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4842
votes: 1


have you tried "echo 1;" near the top to see if anything is produced? If so, just keep echoing numbers until you can see where the script falls.

If there is still no output, try commenting out the lower pieces of code.

Not the best way to debug but should work.
1:24 am on Aug 10, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12702
votes: 244


Can everyone assume you've done the routine checks for invisible errors? nbsp or tab for space, line-end space where there isn't supposed to be one, that kind of thing. All brackets match, nothing interlocking, all nests come out even? In short, the whole category of "D'oh!" errors that are so obvious you don't even think of them.
1:34 am on Aug 10, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Yeah. As far as I can see I've done all that.

And
print "hello";
on the very first line yields nothing if I add the other code after it.

I've now spent over 20 hours commenting bits of code out and still not an error message in sight.
5:52 am on Aug 10, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 15, 2004
posts:941
votes: 0


remove all functions/includes
run the code from a single function in your page
try to debug line by line
make sure you echo/print/var_dump something and that your function doesn't "return" an empty string
Have your full error reporting (E_ALL) in your php and htaccess file

other than that i know not any other way to debug
10:38 am on Aug 10, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


So far, one missing bracket in a preg_match and a missing semi-colon.

That's brought 7 out of 8 functions to life. When I add the last one, it's a complete blank out, everything reverts to blank screen and no error messages.

Never had to add code one line at a time before.
12:17 pm on Aug 10, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Dang! An extra bracket inside one function and a missing bracket inside another.
10:13 pm on Aug 10, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12702
votes: 244


:: twiddling thumbs and whistling idly ::
10:19 pm on Aug 10, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


However, looking at the code as closely as I have over the last couple of days, I identified several potential bugs very early on and already fixed them along the way. Once the syntax was correct the whole thing worked exactly right, first time. I still have no idea why the simplest of syntax errors results in a completely blank screen and no error messages though. I've never spent so much time tracking down such simple errors.
10:26 pm on Aug 10, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 7, 2003
posts:4783
votes: 0


Did you check the apache error log ? I usually keep a tail -f on that one ... and try to run the php from the command line as long as it's not too interactive -> gives you syntax errors that are IMHO easier to deal with.
10:38 pm on Aug 10, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


One of those rare occasions with no log access, and couldn't override from within htaccess - and I did waste an hour or more trying to do that.
2:15 am on Aug 11, 2012 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12702
votes: 244


I still have no idea why the simplest of syntax errors results in a completely blank screen

You get the same thing in javascript. It just sits there poker-faced "Neener-neener, I'm not going to give you the tiniest trace of an iota of a hint about what you did wrong or where you did it. I'll just quietly refuse to execute." So you comment-out the entire content of every single function, cancel your plans for the weekend...

When I'm trying to make sense of someone else's code, the very first thing I do is add a line break before and/or after every single bracket. And then start indenting packages. That's where you get the "Oh, oops, these two elements were supposed to be parallel."
1:12 pm on Aug 11, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


I thought I had done that.

However there was a disconnect between thinking and doing.