Last modified: 2014-11-18 14:52:42 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 T53479, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 51479 - SF Incorrect page name "Some very long page name that will hopefully never get created ABCDEF123" appearing
SF Incorrect page name "Some very long page name that will hopefully never ge...
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
SemanticForms (Other open bugs)
master
All All
: High normal with 2 votes (vote)
: ---
Assigned To: Yaron Koren
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-16 21:51 UTC by Jamie Thingelstad
Modified: 2014-11-18 14:52 UTC (History)
7 users (show)

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


Attachments
Incorrect title being displayed for http://wiki.planetkubb.com/wiki/Event:Des_Moines_Fall_Kubb_Klassic_2013 (178.51 KB, image/png)
2013-07-16 21:51 UTC, Jamie Thingelstad
Details

Description Jamie Thingelstad 2013-07-16 21:51:18 UTC
Created attachment 12865 [details]
Incorrect title being displayed for http://wiki.planetkubb.com/wiki/Event:Des_Moines_Fall_Kubb_Klassic_2013

I'm using f814d9e7e61e12cd171f05ff86fd984d765ff774 of Semantic Forms and had a user send me the following screenshot showing a page with incorrect title of "Some very long page name that will hopefully never get created ABCDEF123" being displayed. I had a 2nd user report that they saw the same thing. Hitting "edit with form" and resaving the page returns it to the correct title. A quick grep shows that this string is in SF_FormLinker.php.
Comment 1 Yaron Koren 2013-07-16 22:00:02 UTC
Are you sure that's not the right page name? LOL How was the page created?
Comment 2 Jamie Thingelstad 2013-07-16 22:06:17 UTC
:-)

That page itself has existed without edit since 2/12/2013 (http://wiki.planetkubb.com/w/index.php?title=Event:Des_Moines_Fall_Kubb_Klassic_2013&action=history) and it was edited today using Edit with Form and on save had that title.
Comment 3 Youri van den Bogert 2013-09-19 07:09:21 UTC
(In reply to comment #1)
> Are you sure that's not the right page name? LOL How was the page created?

This pagename has been generated by a function called createLinkedPage(), located in: semanticbundle/SemanticForms/includes/SF_FormLinker.php.
Comment 4 Youri van den Bogert 2013-09-20 09:30:02 UTC
We've been able to do this on the scratchpad wiki:

First create a 'new' page with the following text: 
[[Houses on 70th ave::foobar]]

View the page and the title will be 'Some very long page name that will hopefully never get created ABCDEF123'. If you refresh the page the title will be displayed correctly.

This also seems to be a fatal error with Approved Revs, it will end in a endless loop if you approve the page that created the other page. We even seen a couple of Apache crashes on this.
Comment 5 Remco de Boer 2013-09-20 13:20:09 UTC
This seems to be related to the parser object. I found what I believe to be the cause of this behaviour. In SF_FormPrinter, several lines have been commented out:

(approx l.440)
//		$oldParser = $wgParser;

//		$wgParser = unserialize( serialize( $oldParser ) ); // deep clone of parser
//		$wgParser->clearState();

(approx l. 1620)
//		$wgParser = $oldParser;

With these lines enabled, the "Some very long..." title is no longer displayed.

However, this does not fix the problematic interaction with ApprovedRevs that Youri reported, although it is no longer fatal. Approving a page with a red link that creates another page now results in the error "Database serialization may cause problems, since the connection is not restored on wakeup." with the following stack trace:

Backtrace:

#0 [internal function]: DatabaseBase->__sleep()
#1 XXX/extensions/SemanticForms/includes/SF_FormPrinter.php(442): serialize(Object(Parser))
#2 [internal function]: SFFormPrinter->formHTML('XXX...', false, false, NULL, NULL, 'Some very long ...', NULL)
#3 XXX/includes/StubObject.php(58): call_user_func_array(Array, Array)
#4 XXX/includes/StubObject.php(77): StubObject->_call('formHTML', Array)
#5 XXX/extensions/SemanticForms/includes/SF_FormLinker.php(169): StubObject->__call('formHTML', Array)
#6 XXX/extensions/SemanticForms/includes/SF_FormLinker.php(169): StubObject->formHTML('XXX...', false, false, NULL, NULL, 'Some very long ...', NULL)
#7 XXX/extensions/SemanticForms/includes/SF_FormLinker.php(288): SFFormLinker::createLinkedPage(Object(Title), Array)
#8 [internal function]: SFFormLinker::setBrokenLink(Object(DummyLinker), Object(Title), Array, 'XXX...', Array, NULL)
#9 ...

Does anyone know why the parser-related lines had been commented out in the first place? Does it have anything to do with the ApprovedRevs error I just observed? Obviously, commenting out these lines is not a proper solution since it results in other problems and even fatal errors/endless loops, so I suggest re-enabling them and fixing the underlying issue. Any ideas?
Comment 6 Yaron Koren 2013-09-20 15:09:02 UTC
This bug report might be covering two or even more bugs at this point - I just cc'ed f.trott, who is in charge of the whole tricky parser copy/serialize/unserialize code. Any thoughts on this?
Comment 7 Remco de Boer 2013-09-25 15:10:14 UTC
I have done some tests with a simple parser function that creates a new page. I encountered similar problems as the ones reported here. I get the impression that the problem lies in performing an 'edit within an edit' (creating a new page as part of the save routine of another page).
 
Apparently, when we wrap the creation of the new page (the execution of doEdit()) in a job and push it on the job queue all of these issues disappear. No need to invocate parser->clearState() in that case, and no more wrong titles 'leaking' via the parser object. ApprovedRevs seems happy too.
Comment 8 Remco de Boer 2013-10-13 22:05:22 UTC
Hi, just wanted to draw your attention to a recent mailing list question related to this bug: "Is WikiPage->doEdit dangerous in a parser tag callback?"

http://www.mail-archive.com/wikitech-l@lists.wikimedia.org/msg71816.html
Comment 9 s7eph4n 2013-11-29 09:17:09 UTC
These lines were put in some MW versions ago to obtain a deep clone of the Parser object (i.e. clone of the parser and all of the contained objects). This parser clone is needed to parse the form with a properly initialized parser (e.g. also including all initialization steps done by any extension) while keeping the original parser state intact. Then in a later MW version people got all excited about the new features of newer PHP versions and included unnamed closures in the Parser (or was it ParserOptions) object. Which are alas not serializable.

The two easy solutions that obviously do not work are to just use the original parser and hope it does not break too badly, and to try to make the Parser serializable again. The first fails with the bug discussed here. The second fails because we will never ever convince anybody to merge a core patch to make the Parser serializable again and also because if any extension somehow managed to attach a closure to the Parser, e.g. via ParserOptions, it fails again.

So there remain two solutions. The first would be to somehow conjure a Parser object from scratch and get it into a state similar enough to wgParser, that it serves our purposes. This mostly includes setting the proper ParserOptions and getting extensions to include their JS and CSS. I do not know if this is even possible, but it would certainly be a major performance drain.

The second would be to finally completely rewrite that function so that it does not change the parser state in a destructive way. This however would probably end up in a complete redesign of SF. Good luck. :P
Comment 10 Remco de Boer 2013-12-03 12:56:31 UTC
What about using the job queue (cf. Comment 7)?
Comment 11 s7eph4n 2013-12-06 15:06:05 UTC
Great. Now I get this, too. I experienced this after introducing "Creates pages with form" on a property and then purging a page containing that property in a printout to a query. I.e. this page was not related to SF whatsoever except that it contained said query.
Comment 12 Jamie Thingelstad 2013-12-07 11:54:13 UTC
Now that you say that, I have only ever seen this issue on wikis I have that use that "creates pages with form" property.
Comment 13 Al Johnson 2013-12-20 03:41:41 UTC
Fwiw, I am also seeing this and I too use  [[Creates pages with form::<form-name>]]

Does a workaround exist?
Comment 14 Al Johnson 2013-12-20 21:58:23 UTC
Refreshing the page or doing another save does not fix this (restore the proper title) for me most of the time.  

This happens just about all the time now after upgrading to the latest SemanticBundle (and then upgrading SF to fix another bug and then fixing another bug myself).  

Also, whenever this long title appears, all of the {{#info}} markup on the page are fully expanded-out and displayed inline on the page instead of hiding in the tooltip so the whole page looks broken.

This looks way over my pay grade to try and hack-a-fix for my new wiki launch.  I really need some kind of solution or workaround that does not involve not using [[Creates pages with...]] since my site relies heavily on them.

Thanks
Comment 15 s7eph4n 2013-12-20 23:17:52 UTC
(In reply to comment #14)
> Refreshing the page or doing another save does not fix this (restore the
> proper
> title) for me most of the time.  

You have to actually change the page on edit, else the editing is discarded. Inserting or removing a space or newline somewhere should do the trick.
Comment 16 Al Johnson 2013-12-20 23:55:28 UTC
@Stephen, I was hoping for a programmatic fix/workaround so the user never sees this.  I can't launch a new site like this.  I really dread rolling all the way back to the SemanticBundle alpha release :(
Comment 17 s7eph4n 2013-12-21 00:06:42 UTC
Yaron,

the fix should be straight-forward. In SFFormLinker::createLinkedPage before calling SFFormPrinter::formHTML set $wgParser to a new Parser and restore it afterwards.

However, while you already are at it, you may also consider moving that call to formHTML into the job. Keeping an expensive function like that outside the job defies the purpose of jobs.

And I am not sure it is necessary to use that bogus title. I had to stop digging, but shouldn'it be possible to use $title->getText() or something like that?

And of course there is the fact that if you have more than one property that defines a form to be used for one red-linked page only one of the properties will be successful. Without notice or warning and with the decision which form is used non-determined.
Comment 18 Al Johnson 2013-12-22 04:12:37 UTC
For me, it looks like a new edit and save is not necessary to restore the correct title.  It's restored after doing a *hard* refresh (CTRL-F5 in FF).  No amount of soft refreshes in FF works.
Comment 19 Neill Mitchell 2014-07-29 16:00:47 UTC
I'm also seeing this occasionally when creating pages with the one step process. 

There does not seem to be any pattern to it. I'm running I'm running SMW 1.9.1 on MW 1.21.11 with SF 2.7.
Comment 20 s7eph4n 2014-07-29 16:07:10 UTC
Raised priority.
Creating pages from red links will crash MW 1.24+. Not once, but all the time as soon as a page creation job is in the job queue.
Comment 21 Neill Mitchell 2014-07-30 10:53:35 UTC
I think I see the pattern now. I use red link auto page creation as well on certain properties. So this appears to be triggered on page save if a new property value is added in the form.
Comment 22 heimlersimon 2014-10-18 15:26:39 UTC
Guess I've found the same bug:

I've tried the "Creates pages with form" special property and this destroyes my wiki page where this property is used. It also gets a "Some very long page name that will hopefully never get created ABCDEF123" title. 
If I revert the special property back to "Has default form", everything works fine again.
Comment 23 Tiago Ferreira 2014-11-18 14:01:22 UTC
Hi,

I'm new to SMW and MW development but, apart from the deprecation of $wgTitle how dirty is this fix?

$sfgFormPrinter->formHTML( $form_definition, false, false, null, $preloadContent, $wgTitle->getBaseText(), null );


Apparently it seems to quick fix this issue.
Comment 24 s7eph4n 2014-11-18 14:13:17 UTC
I would expect this to result in the Title of the page containing the redlink being used as the title of the newly created page.
Comment 25 s7eph4n 2014-11-18 14:52:42 UTC
No, you are right. However, try the following:

1. Have a property that creates pages (e.g. call it someProp)
2. On page Foo add the following text: '[[someProp::Bar]]'
3. Go to page Bar.
4. Delete that page.
5. Go to page Bar again (if you use the Back button do not forget to refresh the browser)

Expected: Deletion and move log for the page Bar.
Observed: Fatal error: Maximum function nesting level of '100' reached, aborting!

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


Navigation
Links