Last modified: 2011-04-30 01:16:49 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T20170, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18170 - Warning with preSaveTransform (possibly PHP 5.3 specific)
Warning with preSaveTransform (possibly PHP 5.3 specific)
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
1.14.x
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: newphp
: 18375 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-26 03:25 UTC by Mike Wacker
Modified: 2011-04-30 01:16 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Mike Wacker 2009-03-26 03:25:42 UTC
This happened to my wiki after I upgraded to PHP 5.3.  I haven't had this issue before.

When I try to preview changes being made to an article (in part or whole) or change the entire article, I get the following warning:

Warning: Parameter 2 to Parser::preSaveTransform() expected to be a reference, value given in /var/www/wiki/wiki/includes/StubObject.php on line 58

When I try to preview an article, it just gives me the warning.  I can't see the preview, but nothing else happens.  However, if I try to edit the entire article (the entire thing, the bug doesn't occur when I edit a specific part) and save the changes, it's followed up by an internal error.  Here's the stack trace that follows:

Original exception: exception 'DBQueryError' with message 'A database error has occurred
Query: INSERT INTO `text` (old_id,old_text,old_flags) VALUES (NULL,NULL,'utf-8')
Function: Revision::insertOn
Error: 1048 Column 'old_text' cannot be null (localhost)
' in /var/www/wiki/wiki/includes/db/Database.php:636
Stack trace:
#0 /var/www/wiki/wiki/includes/db/Database.php(591): Database->reportQueryError('Column 'old_tex...', 1048, 'INSERT INTO `t...', 'Revision::inser...', false)
#1 /var/www/wiki/wiki/includes/db/Database.php(1311): Database->query('INSERT INTO `t...', 'Revision::inser...')
#2 /var/www/wiki/wiki/includes/Revision.php(802): Database->insert('text', Array, 'Revision::inser...')
#3 /var/www/wiki/wiki/includes/Article.php(1544): Revision->insertOn(Object(DatabaseMysql))
#4 /var/www/wiki/wiki/includes/Article.php(1376): Article->doEdit('Use the Taskmas...', 'added miscellan...', 98)
#5 /var/www/wiki/wiki/includes/EditPage.php(1011): Article->updateArticle('Use the Taskmas...', 'added miscellan...', false, false, false, '')
#6 /var/www/wiki/wiki/includes/EditPage.php(2392): EditPage->internalAttemptSave(false, false)
#7 /var/www/wiki/wiki/includes/EditPage.php(453): EditPage->attemptSave()
#8 /var/www/wiki/wiki/includes/EditPage.php(346): EditPage->edit()
#9 /var/www/wiki/wiki/includes/Wiki.php(505): EditPage->submit()
#10 /var/www/wiki/wiki/includes/Wiki.php(63): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
#11 /var/www/wiki/wiki/index.php(114): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
#12 {main}

Exception caught inside exception handler: exception 'DBQueryError' with message 'A database error has occurred
Query: INSERT INTO `text` (old_id,old_text,old_flags) VALUES (NULL,NULL,'utf-8')
Function: Revision::insertOn
Error: 1048 Column 'old_text' cannot be null (localhost)
' in /var/www/wiki/wiki/includes/db/Database.php:636
Stack trace:
#0 /var/www/wiki/wiki/includes/db/Database.php(591): Database->reportQueryError('Column 'old_tex...', 1048, 'INSERT INTO `t...', 'Revision::inser...', false)
#1 /var/www/wiki/wiki/includes/db/Database.php(1311): Database->query('INSERT INTO `t...', 'Revision::inser...')
#2 /var/www/wiki/wiki/includes/Revision.php(802): Database->insert('text', Array, 'Revision::inser...')
#3 /var/www/wiki/wiki/includes/Article.php(1544): Revision->insertOn(Object(DatabaseMysql))
#4 /var/www/wiki/wiki/includes/Article.php(1376): Article->doEdit('Use the Taskmas...', 'added miscellan...', 98)
#5 /var/www/wiki/wiki/includes/EditPage.php(1011): Article->updateArticle('Use the Taskmas...', 'added miscellan...', false, false, false, '')
#6 /var/www/wiki/wiki/includes/EditPage.php(2392): EditPage->internalAttemptSave(false, false)
#7 /var/www/wiki/wiki/includes/EditPage.php(453): EditPage->attemptSave()
#8 /var/www/wiki/wiki/includes/EditPage.php(346): EditPage->edit()
#9 /var/www/wiki/wiki/includes/Wiki.php(505): EditPage->submit()
#10 /var/www/wiki/wiki/includes/Wiki.php(63): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
#11 /var/www/wiki/wiki/index.php(114): MediaWiki->initialize(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
#12 {main}
Comment 1 Mike Wacker 2009-03-26 05:00:06 UTC
Ok, so I found a fix.  It's so simple I'm just going to describe it.  Go to line of 2981 of Article.php.  Add an ampersand before the second argument.

return $wgParser->preSaveTransform( $text, $this->mTitle, $wgUser, ParserOptions::newFromUser( $wgUser ) );

should now be

return $wgParser->preSaveTransform( $text, &$this->mTitle, $wgUser, ParserOptions::newFromUser( $wgUser ) );
Comment 2 Alexandre Emsenhuber [IAlex] 2009-04-01 17:22:50 UTC
Yes, this is a PHP 5.3 specific issue, but passing "&$this->mTitle" as argument will emit an E_WARNING for those who have allow_call_time_pass_reference disabled.
Comment 3 Alexandre Emsenhuber [IAlex] 2009-04-02 19:16:57 UTC
fixed in r49142.
Comment 4 Niklas Laxström 2009-04-07 05:50:23 UTC
*** Bug 18375 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links