phpBB debug notices in various files: Undefined index/offset

Discussions and support about the different URL Rewriting techniques for phpBB.

Moderator: Moderators

phpBB debug notices in various files: Undefined index/offset

Postby IPB_Refugee » Sun Jan 31, 2010 2:33 am

Hello,

during the last days I upgraded my board from 3.0.4 > 3.0.5 > 3.0.6 (and it was not a funny experience...)

I have debug mode enabled in config.php:

Code: Select all
@define('DEBUG', true);
@define('DEBUG_EXTRA', true);


And now I'm getting several debug notices. When I visit the main page in user control panel (ucp.php), I get:

[phpBB Debug] PHP Notice: in file /includes/functions_display.php on line 1287: Undefined offset: 148


After replacing line 1287, which is

Code: Select all
         $phpbb_seo->prepare_iurl($active_t_row, 'topic', $active_t_row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$active_t_forum_id]);


with the following line:

Code: Select all
         $phpbb_seo->prepare_iurl($active_t_row, 'topic', $active_t_row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $active_t_forum_id);


the debug notice is gone.

When I read a topic, I get:

[phpBB Debug] PHP Notice: in file /viewtopic.php on line 393: Undefined offset: 104


This is line 393 in viewtopic.php:

Code: Select all
   $_parent = $phpbb_seo->seo_url['forum'][$forum_id];


There is no more debug notice when I replace the line with:

Code: Select all
   $_parent = $forum_id;


When I do any search, I get something like this:

[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 108
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 104
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 104
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 136
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 102
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 104
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 105
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 282
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 104
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 103
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 148
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 105
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 104
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 71
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 132
[phpBB Debug] PHP Notice: in file /search.php on line 1036: Undefined index: 52


So I get one debug notice per displayed topic (On my board 16 topics per page are displayed.) The number after "Undefined index" is the ID of the forum with the found topic.

When I replace line 1036 in search.php, which is

Code: Select all
         $phpbb_seo->prepare_iurl($row, 'topic', $row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$u_forum_id]);


with

Code: Select all
         $phpbb_seo->prepare_iurl($row, 'topic', $row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $u_forum_id);


the debug notices disappear.

When I try to post a message or a new topic, I get:

[phpBB Debug] PHP Notice: in file /includes/functions_posting.php on line 2784: Undefined offset: 4
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 2477: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3538)


There is no more content on this page besides the two PHP notices. (Nonetheless the message was stored in the data base successfully.)

When I replace line 2784:

Code: Select all
      $phpbb_seo->prepare_iurl($data, 'topic', $topic_type == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$data['forum_id']]);


with:

Code: Select all
      $phpbb_seo->prepare_iurl($data, 'topic', $topic_type == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $data['forum_id']);


everything is okay.

Probably something went wrong during the update. Or does someone else get similar debug notices?
Is it safe to do the code replacements I mentioned above? Or is there a better solution?

Best regards
Wolfgang

EDIT: And when you enable "Activate SQL Rewriting", in posting.php change

Code: Select all
          $_parent = $post_data['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id];


to

Code: Select all
         $_parent = $post_data['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $forum_id;
User avatar
IPB_Refugee
PR0
PR0
 
Posts: 82
Joined: Thu Jul 24, 2008 2:18 pm

Advertisement

Re: phpBB debug notices in various files: Undefined index/offset

Postby dcz » Sat Feb 06, 2010 5:16 pm

This is strange because all these calls to phpbb_seo::prepare_iurl should be preceded by a call to phpbb_seo::set_url which in all cases should fill the phpbb_seo::seo_url['forum'][$id] entry reported as unset in your case.
It is likely that you forgot to update the phpbb_seo::set_url method in phpbb_seo/phpbb_seo_class.php since it's less likely that you forgot all the phpbb_seo::set_url calls in the problematic files.
So make sure that your phpbb_seo_class.php fil is actually up to date, and keep faith, because full debug is always turned on when I dev, and there are no notices in the released code ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Re: phpBB debug notices in various files: Undefined index/offset

Postby IPB_Refugee » Sat Feb 06, 2010 9:22 pm

Hello dzc,

thanks for your response!

I compared my phpbb_seo_class.php to the original file of your download package, and there are indeed two differences: two @ I must have added somewhere during the frustrating updating:

Code: Select all
   function set_url( $url, $id = 0, $type = 'forum',  $parent = '') {
      if ( empty($this->seo_url[$type][$id]) ) {
         return ( @$this->seo_url[$type][$id] = !empty($this->cache_config[$type][$id]) ? $this->cache_config[$type][$id] : sprintf($this->sftpl[$type], $parent, $this->format_url($url, $this->seo_static[$type]) . $this->seo_delim[$type] . $id, $id) );
      }
      return @$this->seo_url[$type][$id];
   }


Is it possible that

return ( @$this->seo_url ... and
return @$this->seo_url ...

are responsible for the debug messages I saw?

Have a nice weekend :)
Wolfgang

PS: SQL rewriting is a nice new feature - thank you!
User avatar
IPB_Refugee
PR0
PR0
 
Posts: 82
Joined: Thu Jul 24, 2008 2:18 pm

Re: phpBB debug notices in various files: Undefined index/of

Postby dcz » Fri Mar 12, 2010 12:50 pm

mm, sorry for delay.

So, I think that the best way to start would be to update to 3.0.7-PL1 and make sure that you indeed have all the mods code in phpBB files (since the @ was not guilty).

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Re: phpBB debug notices in various files: Undefined index/of

Postby IPB_Refugee » Fri Mar 12, 2010 4:37 pm

Hi dcz,

no problem. :)

My board is already up to date but I cannot tell you if the debug notices would still appear because I haven't undone the changes I suggested above.

Have a nice weekend
Wolfgang
User avatar
IPB_Refugee
PR0
PR0
 
Posts: 82
Joined: Thu Jul 24, 2008 2:18 pm

Re: phpBB debug notices in various files: Undefined index/of

Postby SeO » Fri Mar 12, 2010 7:05 pm

I think the notices all came from this : How to kill URL rewriting type "Advanced"
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Re: phpBB debug notices in various files: Undefined index/of

Postby weddingcoo » Fri Nov 18, 2011 4:16 am

waiting ... :(
weddingcoo
 
Posts: 2
Joined: Fri Nov 18, 2011 4:08 am
Location: New York


Return to phpBB mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 3 guests