Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
571 views
in Q2A Core by

The problem was reported here: http://question2answer.org/qa/14867/bug-notice-undefined-index-oupdated-include-page-php-line-207

I upgraded to 1.5.3 and am still getting the notice. In the code it has this (line 201):

$hasother=isset($question['opostid']);

Then the bit added in to fix the bug is (line 203):

!isset($question[$hasother ? 'oupdatetype' : 'updatetype'])

However, although the post in question has the oupdatetype field, it doesn't have the oupdated field, causing the error. This should be the relevant data for the post, hopefully it will help you debug:

Array
(
    [postid] => 175
    [categoryid] => 
    [type] => Q
    [basetype] => Q
    [hidden] => 0
    [acount] => 3
    [selchildid] => 196
    [closedbyid] => 
    [userid] => 50
    [obasetype] => A
    [ohidden] => 1
    [opostid] => 186
    [ouserid] => 105
    [oip] => [the IP address]
    [otime] => 1329477831
    [oflagcount] => 0
    [oupdatetype] => 
    [_order_] => 7
    [sort] => -1329477831
)

One thing I did notice is the answer given by opostid (#186) is hidden, but the blurb says "edited 8 months ago by [user]". Whereas on all other hidden posts, their last action is always "hidden by..." (since you can't edit hidden posts).   Also, on the IP page the post says "hidden Jan 1, 1970".

So perhaps the problem is caused somewhere else by the 'hidden' event not registering?

Q2A version: 1.5.3

1 Answer

0 votes
by

Thanks for this. Please change the last two if()s in function qa_db_add_selectspec_opost(...) in qa-db-selects.php to:

 

if ($fromupdated)
  $selectspec['columns']['oupdatetype']=$poststable.'.updatetype';
 
if ($full) {
  $selectspec['columns']['ocontent']=$poststable.'.content';
  $selectspec['columns']['oformat']=$poststable.'.format';
}
 
if ($fromupdated || $full)
  $selectspec['columns']['oupdated']='UNIX_TIMESTAMP('.$poststable.'.updated)';
 
This will be rolled into Q2A 1.5.4.
...