Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI_Exceptions::show_error wrong behaviour #4036

Closed
KN4CK3R opened this issue Aug 7, 2015 · 6 comments
Closed

CI_Exceptions::show_error wrong behaviour #4036

KN4CK3R opened this issue Aug 7, 2015 · 6 comments
Milestone

Comments

@KN4CK3R
Copy link
Contributor

KN4CK3R commented Aug 7, 2015

I found a strange behaviour with the show_error method.
Test code looks like this:

Controller:

$this->load->view('exists');

View (exists.php):

This should not be visible
<?php
$this->load->view('does_not_exists');
?>

The call to $this->load->view('does_not_exists'); triggers an error because the view does not exist.
The generated output looks like this: http://abload.de/img/testzrswq.jpg
I would expect only the error message to be displayed, like if the controller would use $this->load->view('does not exists');.

I found this because my view looked like this:

<div style="display:none">
<?php
$this->load->view('does_not_exists');
?>
</div>

which suppresses the error message.

@narfbg narfbg added this to the 3.1.0 milestone Aug 10, 2015
@narfbg
Copy link
Contributor

narfbg commented Aug 10, 2015

Just to clarify - I do consider this to be a bug, but I wouldn't at all be surprised if somebody actually depends on the current behavior, so I'm thinking of fixing it in version 3.1 (pending some internal discussion).

@aanbar
Copy link
Contributor

aanbar commented Aug 10, 2015

If it's going to block the entire response when failing to load a view, then I think this should have a backtrace to show which view is requesting the non-existent view.
At its current form, when the error is being displayed in certain block, You know which view contains the wrong load->view.

@narfbg
Copy link
Contributor

narfbg commented Aug 10, 2015

Well, that's if this is only relevant to views loading other views, but that's unclear right now.

@jim-parry
Copy link
Contributor

I do not agree that this is a bug.
With the original view shown (nothing about CSS styling), the text before the PHP tag is sent to the browser as expected.
When the error message is triggered, that is trapped by CI and added to the browser output.

If there were a PHP error, I would expect to see the PHP error message(s), and then the contents of the view, including any CI error messages.

@narfbg
Copy link
Contributor

narfbg commented Sep 9, 2015

It is contentious, indeed.

If we consider an error displayed after e.g. a hundred lines of output, it could be hard to spot or even completely hidden via styling. On the other hand, not discarding previous output helps in (visually) spotting where the error has occurred.

@narfbg
Copy link
Contributor

narfbg commented Dec 12, 2015

#4189 (and #4220 in particular) makes this one obsolete.

@narfbg narfbg closed this as completed Dec 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants