Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-23-2012, 11:24 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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:
Warning: Cannot modify header information - headers already sent by (output started at [path]/includes/adminfunctions.php:299) in [path]/includes/functions.php on line 4116
Reply With Quote
  #2  
Old 05-27-2012, 05:41 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've narrowed it down to the if ($numresults == 1) conditional from this code:

Code:
if ($numresults == 1)
{
	$quote = $db->fetch_array($getquotes);
	exec_header_redirect("quote.php?" . $vbulletin->session->vars['sessionurl'] . "quoteid=" . $quote['quoteid'] . "&do=update");
}
else if (!$numresults)
{
	print_stop_message('no_quotes_matched_your_query');
}
else
{

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?
Reply With Quote
  #3  
Old 05-27-2012, 06:20 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What happens if you modify it to <= or => rather than == ?
Reply With Quote
  #4  
Old 05-27-2012, 06:50 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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(); ?>
<?php

and this to the bottom of the page (below the ?>), so now it looks like this :

Code:
?>
<? ob_flush(); ?>

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.
Reply With Quote
  #5  
Old 05-27-2012, 02:31 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
ob_start();
   include(
'mystuff.php');
   
$stuff ob_get_contents();
ob_end_clean(); 
Reply With Quote
  #6  
Old 05-27-2012, 02:56 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 05-27-2012, 06:45 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If it works regardless of the error just supress the erro, do you think its down to deprecated code?
Reply With Quote
  #8  
Old 05-27-2012, 06:55 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Simon Lloyd View Post
If it works regardless of the error just supress the erro, do you think its down to deprecated code?
If it was deprecated code, you would think PHP would show that, I would think, wouldn't it?
Reply With Quote
  #9  
Old 05-27-2012, 07:17 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 05-27-2012, 07:28 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:29 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
  • Page Generation 0.04450 seconds
  • Memory Usage 2,260KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete