Page MenuHomePhabricator

sfEditFormPreloadText no longer works as it used to
Closed, ResolvedPublic

Description

9c08a1871d1368a4f18077dd2d763a6a475cf869

https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticForms.git;a=commit;f=includes/SF_AutoeditAPI.php;h=9c08a1871d1368a4f18077dd2d763a6a475cf869

seems to have broken the way that I've been using sfEditFormPreloadText

I dynamically generate page content, so add as many 9s as you like, but please don't save.

http://snpedia.com/index.php?title=Rs99999999999(G;T)&action=edit
correctly prepoulates a template based on the page title using the EditFormPreloadText hook. However equivalent function for sfEditFormPreloadText no longer works.

http://snpedia.com/index.php/Special:FormEdit/Genotype/rs999999999999999(T;T)

http://snpedia.com/index.php/Special:FormEdit/Genotype/rs999999999999999(T;T)


Version: master
Severity: normal

Details

Reference
bz47150

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:31 AM
bzimport set Reference to bz47150.

Re-assigning to f.trott. f.trott - I looked into this, and it looks like there's something a little off about the "if" statements around this hook. Line 776 of /includes/SF_AutoeditAPI.php, which is currently:

if ( !isset( $this->mOptions[ 'preload' ] ) || $this->mOptions[ 'preload' ] !== false ) {

...seems like it would make more sense as:

if ( !isset( $this->mOptions[ 'preload' ] ) || $this->mOptions[ 'preload' ] === false ) {

However, that might not be the only issue.

Related URL: https://gerrit.wikimedia.org/r/61815 (Gerrit Change I080bd4473635c26e8a8b853d5272f892ed00b639)

Mike, could you give the above patch a try and see if it fixes the issue?

I have tested. It does not resolve the issue. The function specified in sfEditFormPreloadText is not being called.

Darn, would have been too easy if that had worked. Thanks for testing.
Guess I'll have to work a bit more on this.

Ok, I think this is fixed now.

It was actually not a problem in the autoedit API, but in the Special:FormEdit page handler.

can you point me towards a url for info on the commit. I'd like to test this, but I don't know what to test.

https://gerrit.wikimedia.org/r/61815 (Gerrit Change I080bd4473635c26e8a8b853d5272f892ed00b639) | change APPROVED and MERGED [by Foxtrott]

smw wrote:

Unexpected non-MediaWiki exception encountered, of type "Exception"
[b5d1c537] [no req] Exception from line 440 of /srv/www/core/extensions/SemanticForms/includes/SF_FormPrinter.php: Serialization of 'Closure' is not allowed
Backtrace:
#0 /srv/www/core/extensions/SemanticForms/includes/SF_FormPrinter.php(440): serialize(Parser)
#1 /srv/www/core/extensions/SemanticForms/includes/SF_AutoeditAPI.php(800): SFFormPrinter->formHTML(string, boolean, boolean, integer, string, string, NULL)
#2 /srv/www/core/extensions/SemanticForms/includes/SF_AutoeditAPI.php(116): SFAutoeditAPI->doAction()
#3 /srv/www/core/extensions/SemanticForms/specials/SF_FormEdit.php(89): SFAutoeditAPI->execute()
#4 /srv/www/core/extensions/SemanticForms/specials/SF_FormEdit.php(46): SFFormEdit::printForm(string, string, NULL, boolean)
#5 /srv/www/core/includes/SpecialPage.php(631): SFFormEdit->execute(string)
#6 /srv/www/core/includes/SpecialPageFactory.php(488): SpecialPage->run(string)
#7 /srv/www/core/includes/Wiki.php(298): SpecialPageFactory::executePath(Title, RequestContext)
#8 /srv/www/core/includes/Wiki.php(602): MediaWiki->performRequest()
#9 /srv/www/core/includes/Wiki.php(467): MediaWiki->main()
#10 /srv/www/core/index.php(49): MediaWiki->run()
#11 {main}

I'm getting this exception when I try to create-with-form a new document via a redlink. The sfEditFormPreloadText extension I'm using ( see #56569 ) is registered but the body of the hook function just returns true. HEAD doesn't trigger the exception.

smw wrote:

My bad, ignore me -- I missed the year on these posts :-/