Welcome Guest, Not a member yet? Register   Sign In
White screen and its magical solution
#1

[eluser]#1313[/eluser]
This is my first time seeing such strange things happen. Pure magick.

I had a stable and running CI application which used Views library. A few hours ago i decided to leave it and start using Rick Ellis' solution to templating (http://ellislab.com/forums/viewthread/44916/). I successfully moved my back-office to this new 'templating technique'. Then i started moving my news section, and then magic happened.

The index() function of my News() controller ends with
Code:
$data['page']['title'] = 'News page';
        $data['view'] = 'news/news-view';
        $this->load->vars($data);
        $this->load->view('page');

and page.php view is
Code:
<?php
$this->load->view('header-part');
$this->load->view($view);
$this->load->view('footer-part');
?>
Quite simple and self-explaining. And it is working fine on my back-end. But on my news page it gave me white screen (with normal profiling info, because i have Profiler enabled). I checked everything ten times, fixed a few bugs, but didn't scratch this white screen at all. I put some debug info into page.php view but it didn't show, so i assume this view was not loading at all.

Then in desperation i added
Code:
ini_set('error_reporting','E_ALL');
line to constructor of my News class and immediately received second dose of pure magick, because white screen just -- well, fixed itself and my page showed okay.

I received NO error messages, none at all. When i delete this ini_set line the white screen immediately returns. WTF?

Here is my News controller.
Code:
<?php

class News extends Controller {

    function News() {

        parent::Controller();
        ini_set('error_reporting','E_ALL');
                // pure magick
        if ($this->config->item('enable_benchmarking')) $this->output->enable_profiler(TRUE);

    }

...
Please share your thoughts on this matter. I feel really stupid and i hope that this is a result of my mistake, because i don't believe in magic, in PHP especially. Please help!
#2

[eluser]Michael Wales[/eluser]
Usually the pure white screen means there is a PHP error (syntax, something like that). Interesting that it's not echoing out any error though....
#3

[eluser]#1313[/eluser]
I do receive messages from CI about php-notices and php-warnings, so i don't think that this is a PHP issue.

ps: I am working under Apache on Windows, if it matters.
#4

[eluser]Michael Wales[/eluser]
What are those messages? How high is your error_reporting bumped up (in config.php)?

If the most common cause of the white screen is a PHP error, and CI is telling you all about these PHP Notices and Warnings, how could not think it was a PHP error?
#5

[eluser]#1313[/eluser]
I mean that my level of error_reporting is high enough to receive notices and warnings.

The fact that i did receive profiler info moves me to the conclusion that it was a bug connected to my views and/or variable loading.
#6

[eluser]sophistry[/eluser]
sometimes when you use CI-reserved names for functions, things go haywire. do you have any functions named view, for instance?
#7

[eluser]alexsancho[/eluser]
Are you sure that you php.ini has display_errors enabled?, add this line after your ini_set to ensure

Code:
ini_set('display_errors', 1);
#8

[eluser]rainmanx[/eluser]
I don't know if this will help, but you could take a look at this: http://ellislab.com/forums/viewthread/56059/ . It was a problem I encountered that manifested the same blank screen. Maybe it helps.

The blank screen usually means an error in your php syntax. It's not the first time an error does not trigger an error message and just stops. Do you have any code in the page source? If so, please post it.

The same thing happened to me once; the app was running just fine on localhost, but was serving blank pages on the remote host. The solution - I changed the hosting provider :cheese:
#9

[eluser]#1313[/eluser]
[quote author="sophistry" date="1188504039"]sometimes when you use CI-reserved names for functions, things go haywire. do you have any functions named view, for instance?[/quote]

I was thinking about something like this, as i witnessed apache fail when i named one of my functions model() instead of car_model(). Maybe this time this issue is connected somehow to variable names, because my $data['view'] and $data['page'] variables do look a little suspicious from this p.o.v. Maybe somebody from the dev team can write down for us a list of 'bad words' in CI namespace?

[quote author="rainmanx" date="1188512940"]I don't know if this will help, but you could take a look at this: http://ellislab.com/forums/viewthread/56059/ . It was a problem I encountered that manifested the same blank screen. Maybe it helps.[/quote]

Yes, i've looked through that thread already, this is not my issue. Thanks anyway.
#10

[eluser]sophistry[/eluser]
check the bottom of this manual page for the list of reserved names in CI




Theme © iAndrew 2016 - Forum software by © MyBB