-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notice: Undefined index: message_ids in read.php on line 270 #838
Comments
Wait, something else smells fishy here too. There's a different behavior of Phorum whether case is enabled or not. Ignoring the warning for a second, the behavior is:
Another bug? By: Markus [email protected] |
Yeah, this looks like an issue with new moderated threads when logged in as a moderator. The thread would have no message ids in the meta data. I am not sure it has anything to do with caching. |
There was another comment on http://trac.phorum.org/ticket/944 and I agree with Markus. With caching on message is seen to all despite being hidden. |
And also marked as hidden despite being visible! |
I tried to reproduce this behavior (version 5.2.20) without success, no notices or warnings. Meta data always contains the message_ids value... Perhaps already corrected? |
Steps to rperoduce:
The following will be generated (I wrapped the long lines):
{{{
( ! ) Notice: Undefined index: message_ids in read.php on line 270
Call Stack
Time Memory Function Location
1 0.0029 325788 {main}( ) ../read.php:0
( ! ) Warning: sort() expects parameter 1 to be array, null given in read.php
on line 276
Call Stack
Time Memory Function Location
1 0.0029 325788 {main}( ) ../read.php:0
2 0.0490 3626740 sort ( NULL ) ../read.php:276
( ! ) Warning: array_slice() expects parameter 1 to be array, null given in
read.php on line 305
Call Stack
Time Memory Function Location
1 0.0029 325788 {main}( ) ../read.php:0
2 0.0498 3627148 array_slice ( NULL, 0, '30' ) ../read.php:305
( ! ) Warning: Invalid argument supplied for foreach() in read.php on line 325
Call Stack
Time Memory Function Location
1 0.0029 325788 {main}( ) ../read.php:0
( ! ) Warning: Cannot modify header information - headers already sent by (output started
at read.php:270) in common.php on line 1805
Call Stack
Time Memory Function Location
1 0.0029 325788 {main}( ) ../read.php:0
2 0.0579 3793172 include( 'posting.php' ) ../read.php:857
3 0.0616 3915172 include( 'include/posting/check_permissions.php' ) ../posting.php:504
4 0.0618 3918988 phorum_redirect_by_url( $redir_url =
'http://phorum/phorum/list.php?10' ) ../check_permissions.php:159
5 0.0618 3918988 header ( 'Location: http://phorum/phorum/list.php?10' ) ../common.php:1805
}}}
This will not happen when the message cache is disabled.
Looking at the database, it makes sense that line 270 in the source fails first. The meta property in the database looks like this:
{{{
a:0:{}
}}}
And line 270 like this:
{{{
267 if($PHORUM["DATA"]["MODERATOR"] && isset($data[$thread]["meta"]["message_ids_moderator"])) {
268 $message_index=$data[$thread]['meta']['message_ids_moderator'];
269 } else {
270 $message_index=$data[$thread]['meta']['message_ids'];
271 }
}}}
I think the fix could be as simple as:
{{{
$message_index=isset($data[$thread]['meta']['message_ids']) ?
$data[$thread]['meta']['message_ids'] :
array();
}}}
I.e. always have an array, either empty or with content.
Reported by: Markus [email protected]
Imported from TRAC: http://trac.phorum.org/ticket/944
The text was updated successfully, but these errors were encountered: