SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What are some circumstances under which this code...

    ... will print a blank white page? None of the functions use try/catch blocks or other error handling techiques. If they contained faulty code or triggered a runtime error, it would print an error message - right?

    PHP Code:
    error_reporting(E_ALL);

    $var1 "something";
    $var2 $var1 " else";
    if (empty(
    $var1)) {
      echo 
    "Debugging message 1";
      
    doSomething();
    }
    else {
      echo 
    "Debugging message 2";
      if (
    $var2 == "something else") {
        echo 
    "Debugging message 3";
        
    doSomethingElse($var1);
      }
      else {
        echo 
    "Debugging message 4";
        
    doAnotherThing();
      }

    I should also point out that essentially the same code worked well the week before last.

    Moderators: I previously posted this to the JavaScript forum by mistake. As you may guess, I've had a very long day trying to figure this out. Please delete that thread.

  2. #2
    SitePoint Guru glenngould's Avatar
    Join Date
    Nov 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What are some circumstances under which this code...
    ... will print a blank white page?
    It would always print -at least- "Debugging message 2" and then "Debugging message 3" wouldn't it?
    Tweep List adds an avatar menu to Twitter (open source)
    Word Stats shows your most used words on Twitter

  3. #3
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by glenngould View Post
    It would always print -at least- "Debugging message 2" and then "Debugging message 3" wouldn't it?
    In a sane and orderly universe, I think it would. But we're talking about where I work.

  4. #4
    SitePoint Guru glenngould's Avatar
    Join Date
    Nov 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then let us know the cause when you find one I'm curious.
    Tweep List adds an avatar menu to Twitter (open source)
    Word Stats shows your most used words on Twitter

  5. #5
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,192
    Mentioned
    17 Post(s)
    Tagged
    4 Thread(s)
    I get debugging message 2 and 3. You could try using strcmp() instead of equality.

  6. #6
    SitePoint Wizard wheeler's Avatar
    Join Date
    Mar 2006
    Location
    Gold Coast, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try adding this as well:
    PHP Code:
    ini_set('display_errors'1); 
    My guess is one of the two functions is either unavailable or has a syntax error.
    Studiotime - Time Management for Web Developers
    to-do's, messages, invoicing, reporting - 30 day free trial!
    Thomas Multimedia Web Development

  7. #7
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wheeler View Post
    try adding this as well:
    PHP Code:
    ini_set('display_errors'1); 
    My guess is one of the two functions is either unavailable or has a syntax error.
    The server wasn't bashful about displaying any and all errors before. Why would it suddenly stop?

  8. #8
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe someone realized it should be off by default.

    Also, output buffering could trap all output.

  9. #9
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps you should hook in Xdebug or Zend Debugger.

  10. #10
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by glenngould View Post
    Then let us know the cause when you find one I'm curious.
    There was an errant video player widget on the same dev server as the site I was working on. It was causing seg faults. Someone was modifying a parent class of the widget at the time. I wish I had time to troubleshoot someone else's code because I'm curious about exactly what went wrong. The framework has an insane number of layers of inheritance. I'm surprised it works at all.

  11. #11
    SitePoint Addict skunkbad's Avatar
    Join Date
    Apr 2008
    Location
    Temecula, CA
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I get:

    Debugging message 2Debugging message 3
    Fatal error: Call to undefined function doSomethingElse() in E:\wamp\www\script_library\test.php on line 27

  12. #12
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by skunkbad View Post
    I get:

    Debugging message 2Debugging message 3
    Fatal error: Call to undefined function doSomethingElse() in E:\wamp\www\script_library\test.php on line 27
    Thanks. I'll have it fixed in a jiffy!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •