Undefined offset in announcement (error)

Current Version: 1.0.6
Released: 09.01.10
Forum rules
Before creating a new support thread, please take a look in the board3 Portal FAQ and use the search!
Many questions have already been answered.
Locked

Topic author
mk1200
Active Member
Posts: 16
Joined: 17. December 2008 16:08
phpBB.com User: mk1200

Undefined offset in announcement (error)

Post by mk1200 »

Your Portal Version: 1.0.2
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Basic Knowledge

PHP Version: 5.2.6
MySQL Version: 5.0.51a

What have you done before the problem was there?
A moderator posted an announcement and I bumped the number of announcements on the portal to 2. It was originally 1 and pushed the old announcement off of the homepage.

So both announcements were showing up fine. 1 of the announcements was downgraded to a normal topic and 1 of the announcements is showing on the homepage. Everything looks good, but my error log has something strange in it.


What have you already tryed to solve the problem?
Nothing

Description and Message
Here is my cPanel error log:

Code: Select all

[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 244 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 245 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 253 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 260 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 262 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 263 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 264 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 265 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 266 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 267 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 268 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 270 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 271 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 271 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 274 : Undefined offset:  1
[27-Jan-2009  03:50:48 -28800] [phpBB Debug] [client 72.30.142.185] [File portal.php?announcement=1] PHP Notice: in file /home/xxxxx/public_html/portal/block/announcements.php on line 280 : Undefined offset:  1
The IP belongs to Yahoo.[/i]
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: Undefined offset in announcement (error)

Post by Kevin »

This happens e.g. if the second announcement is called by url (portal.php?announcement=1) although the portal is set to display only one.
In your constellation this might have happened because a bot or something has called a url of your portal from times, where it was set to display two.
Anyway, this could be called a bug, nobody likes debug errors. The fix should look like this:
Open announcements.php, search:

Code: Select all

$announcement = request_var('announcement', -1); 
add after:

Code: Select all

$announcement = ($announcement > $portal_config['portal_number_of_announcements'] -1) ? -1 : $announcement; 
This will handle a call to announcement numbers higher than the portal_number_of_announcements value.

Here is the complete ticket and solution: bugtracker/viewbug.php?b=140
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
mk1200
Active Member
Posts: 16
Joined: 17. December 2008 16:08
phpBB.com User: mk1200

Re: Undefined offset in announcement (error)

Post by mk1200 »

Thanks, editing the file now.
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: Undefined offset in announcement (error)

Post by Kevin »

Wait, take this code:

Code: Select all

$announcement = ($announcement > $portal_config['portal_number_of_announcements'] -1) ? -1 : $announcement;  
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
mk1200
Active Member
Posts: 16
Joined: 17. December 2008 16:08
phpBB.com User: mk1200

Re: Undefined offset in announcement (error)

Post by mk1200 »

Got it.
Locked

Return to “board3 Portal 1.0.x - English Support”