![]() |
Strange "Cannot modify header information" error
I am getting this error whenever I do a search for a quote name in a mod I did a long time ago. It just started happening after I upgraded to 4.1.12 PL1 a few weeks back. The strange thing is I can edit quotes and do a "Find All Quotes" listing fine, but if I try to search for a quote name, I get the error. But not on all names. It seems to be sporadic.
The quotes are in the db, not a file. Does anyone have any idea why this is happening now when it was fine before? Quote:
|
I've narrowed it down to the if ($numresults == 1) conditional from this code:
Code:
if ($numresults == 1) I only get the error if there is just one result. Any more than 1 result and everything works fine. Does anyone have any idea why it is doing this and how to fix it? |
What happens if you modify it to <= or => rather than == ?
|
No change. I tried that first. I did find a fix that works, however. I added this to the top of the page (above the <?php), so it now looks like this:
Code:
<? ob_start(); ?> and this to the bottom of the page (below the ?>), so now it looks like this : Code:
?> And now the error is gone. I looked at the file in CPanel, but I couldn't see any UTF-8 BOM in the file at all, so I was stumped. |
Doh!, i should have thought of that, you don't have to add it to the page though, it should be able to go in the plugin :), i use similar in some of my plugins :)
PHP Code:
|
Well, it's a file for my quotes mod. It doesn't have any plugins. Like I said earlier, there was no BOM in the file so I have no idea what changed in vB 4.2.0 to start giving that error. My site did move to another server recently, but IIRC, it as showing that error after I upgraded and before the move. But the file is an older one. I think I am using the same code in it as I did for vb 3.5, but it has always worked fine except for the error.
|
If it works regardless of the error just supress the erro, do you think its down to deprecated code?
|
Quote:
|
it depends whether the error reporting is set right for your version of php :), you know, where you saw "E_Error ~ALL" and other types of reporting, you had to add 8192 (i think, dont quote me on it) at one point, deprocated errors didnt come along until php5.3.x, take a look here http://php.net/manual/en/function.error-reporting.php
|
I am on PHP 5.3.10 and MySQL Version 5.5.22-cll. This is what I am using in the file:
Code:
error_reporting(E_ALL & ~E_NOTICE); One thing has got me thinking though. It was something Paul said about UTF-8 BOM. My tables in the db are all set at: Code:
CHARSET=utf8 COLLATE=utf8_unicode_ci I'm wondering if that could be any part of that is going on. |
All times are GMT. The time now is 11:37 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|