Last modified: 2011-11-24 04:07:46 UTC
I have a form: {{{ info | ... | page name = <unique number;start=1> }}} ... This worked before, but recently broken. It r102365 "strict comparators for empty strings" caused regression. Look at `specials/SF_FormEdit.php': function execute( $query, $redirectOnError = true ) { global $wgRequest, $wgOut; wfProfileIn( __METHOD__ ); $this->setHeaders(); $this->mForm = $wgRequest->getVal( 'form' ); $this->mTarget = $wgRequest->getVal( 'target' ); If I create a new page and want a name is calculated by formula, I do not specify target name, so $target->mTarget is null. Before it was not a problem, because `( $this->mTarget == '' )' evaluates to true. But not most (all?) of comparisons converted to `==='. `( $this->mTarget === '' )' evaluates to false, so execution goes by a path as page name is specified, while actually is not. I can edit the page, but pressing `Save' causes error …someting about empty title. Quick workaround for the problem could be: if ( is_null( $this->mTarget ) ) { $this->mTarget = ''; }
Thankfully, this error wasn't as severe as it seemed - it only happened in cases where the page name formula consists only of a "<unique number...>" tag. But diagnosing the problem - I just checked in what I believe is a fix.
> Thankfully, this error wasn't as severe as it seemed - it only happened in > cases where the page name formula consists only of a "<unique number...>" tag. Yes, but it is a showstopper for my site. > But diagnosing the problem - I just checked in what I believe is a fix. What revision? I just updated sources to r103790, and still cannot create a page: > Error: The inserted data results in an empty page title.
Ah, that's too bad. The relevant change was this one, r103718: r1=103129&r2=103718">http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticForms/specials/SF_FormEdit.php?r1=103129&r2=103718 It happened before the revision you updated to, so it really should have worked. Could you check, just in case, to make sure that this change is in your code?
Hmm… r103718 looks like a good fix, but it does not help in my case (checked on r104063). My problem is caused by `SF_FormEdit.php' line 110: > if ( $target_name === '' ) { This is the first fork where execution goes to wrong direction. Note: This is the first, but not last. If I fix this one > if ( $target_name == '' ) { I have another error: Fatal error: Call to a member function getUserPermissionsErrors() on a non-object in /var/www/ocw/mediawiki-1.17.1/extensions/SemanticForms/includes/SF_FormPrinter.php on line 390 I tried to debug further but later I decided > if ( is_null( $this->mTarget ) ) { > $this->mTarget = ''; > } in the beginning of `execute' is the easiest workaround.
Okay, I get it. I took your advice, but put in very similar code SF_FormEdit.php, instead of SF_FormPrinter.php, because it seemed like the more general solution. I checked it in to SVN - does this fix your problem?
> I took your advice,… No, that was not an advice. That was description of my attempt to get my site works after an update, and spend not too much time debugging the code. > …does this fix your problem? Yes, not it works. Checked on r104081. Thanks. BTW, please pay attention to bug 32533 -- it requires 3 characters (`\s*') to be fixed. Thanks again.
Well, your description was still pretty good advice. :)