MyBB-Plugins Forums
Turn off php warnings for individual pages? - Printable Version

+- MyBB-Plugins Forums (http://forums.mybb-plugins.com)
+-- Forum: MyBB General Discussion (http://forums.mybb-plugins.com/Forum-MyBB-General-Discussion)
+--- Forum: Coding Help (http://forums.mybb-plugins.com/Forum-Coding-Help)
+--- Thread: Turn off php warnings for individual pages? (/Thread-Turn-off-php-warnings-for-individual-pages)



Turn off php warnings for individual pages? - b.h. - 12-20-2017

I'm not sure why,  but one of my custom pages is sending me a:  

the followings warnings occurred message.

Its a: Warning [2] cannot modify header information- headers already sent warning.

It only occurs for guests Huh Huh  ( which I have denied access to the page) I have other users that are denied access, but for those groups the access denied displays correctly( no php warning)

2 questions

1) any ideas why?
2) is there a way to turn off the warnings on the individual page.


Quote:[PHP]                                          errorHandler->error

/inc/functions.php        1649         header

/inc/class_session.php
    348        my_setcookie
/inc/class_session.php     98         session->load_guest
/global.php                     55          session->init



RE: Turn off php warnings for individual pages? - Diogo Parrinha - 12-20-2017

Hi,

I don't know which page it is. Anyway, if you're modifying pages with the Windows Notepad, you'll likely have problems like this.

Regards,
Diogo


RE: Turn off php warnings for individual pages? - b.h. - 12-21-2017

using notepad++

making my own custom pages



PHP Code:
<?php 

$templatelist 
'BookDB7';
define('IN_MYBB'1); require "./global.php";

add_breadcrumb("BookDB7""BookDB7.php"); 

eval(
"\$html = \"".$templates->get("BookDB7")."\";"); 

if(
in_array($mybb->user['usergroup'], array('1','89','120','157')))
{
error("Access denied");


output_page($html);

?>
this is the code for the page

but is there a way just to turn off the warnings for this page?


RE: Turn off php warnings for individual pages? - Diogo Parrinha - 12-21-2017

Hmm you have "PHP Code:" before <?php

Regarding individual page configuration, I don't think it's possible.

It would still be nice to see a screenshot otherwise it's hard to understand when the warning happens and why.


RE: Turn off php warnings for individual pages? - b.h. - 12-21-2017

I will try to post a screen shot when I get a chance.

That" Php code" is a copy error, I corrected it above.


RE: Turn off php warnings for individual pages? - b.h. - 12-22-2017

I figured it out. Not sure why but, your first assessment was correct. It was a linebreak or whitespace issue.
I compressed the code to 1 line in an editor and it fixed it on the new upload.

what editor are you using to make sure this does not happen to you?


RE: Turn off php warnings for individual pages? - Diogo Parrinha - 12-23-2017

I use Notepad++ Smile At some point you might have opened it with another editor probably or copy/pasted something, I have no idea.


RE: Turn off php warnings for individual pages? - b.h. - 12-23-2017

(12-23-2017, 05:05 AM)Diogo Parrinha Wrote: I use Notepad++ Smile At some point you might have opened it with another editor probably or copy/pasted something, I have no idea.

Thanks for pointing me in the right direction Wink