htzone Posted August 23, 2010 Share Posted August 23, 2010 So, I'm getting a blank PHP page and it's driving me nuts. Unfortunately the client won't let me post my code up here, but rest assured that I'm an experienced web developer and have checked all of the usual suspects. I enabled error reporting, checked my apache error log, and neither of those produce any messages. The syntax is correct. I tossed in "die('here!')" in a few places until I couldn't see it. I narrowed down the stop point as being somewhere in the middle of a foreach loop. Before this foreach loop, I'm using array_merge on some fairly large pieces of data, but nothing unreasonable. When I comment out the array_merge line, the page works correctly. I figured maybe there was some kind of memory issue, or execution timeout thing going on, but when I increase both of those settings it has no effect. In essence, I'm wondering what might be some causes of the blank page problem beyond the common ones, since I'm really scratching my head over this one. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 23, 2010 Share Posted August 23, 2010 So, what values did you set error_reporting and display_errors to? Quote Link to comment Share on other sites More sharing options...
samshel Posted August 23, 2010 Share Posted August 23, 2010 What version of PHP are you using ? http://php.net/manual/en/function.array-merge.php Warning The behavior of array_merge() was modified in PHP 5. Unlike PHP 4, array_merge() now only accepts parameters of type array. However, you can use typecasting to merge other types. See the example below for details. Make sure both parameters are array, else type cast them to be on the safe side. Quote Link to comment Share on other sites More sharing options...
htzone Posted August 23, 2010 Author Share Posted August 23, 2010 I figured it out - there was a forgotten-about error_reporting(0) in one of my support files. This is what happens when you're coding on an empty stomach! Thanks for you help! Quote Link to comment Share on other sites More sharing options...
samshel Posted August 23, 2010 Share Posted August 23, 2010 Good for you !! have some food and mark this as solved ! Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 24, 2010 Share Posted August 24, 2010 In general, you should only set error_reporting/display_errors/log_errors globally, either in your master php.ini (when you have access to it, such as on your development system), in a local php.ini (when php is running as a CGI), or in a .htaccess file (when php is running as an Apache module.) Setting them to OFF in your code generally means you hiding errors rather than fixing them and it will come back and bite you at some point in time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.