Last modified: 2010-10-13 01:53:39 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 T27504, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25504 - FlaggedRevsHooks::maybeMakeEditor() and checkAutoPromote() seem to use variables defined locally in editSpacingCheck()
FlaggedRevsHooks::maybeMakeEditor() and checkAutoPromote() seem to use variab...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
FlaggedRevs (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Rob Lanphier
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-12 20:41 UTC by lampak
Modified: 2010-10-13 01:53 UTC (History)
4 users (show)

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


Attachments

Description lampak 2010-10-12 20:41:25 UTC
Actually I'm not sure if I'm not wrong, because I thought something like this should cause a crash, so maybe it's ok, but...

				$pass = self::editSpacingCheck(
					$wgFlaggedRevsAutoconfirm['spacing'],
					$wgFlaggedRevsAutoconfirm['benchmarks'],
					$user
				);
				# Make a key to store the results
				if ( !$pass ) {
					$wgMemc->set( $APSkipKey, 'true',
						3600 * 24 * $spacing * ( $benchmarks - $needed - 1 ) );
					return true;
				} else {
					$wgMemc->set( $sTestKey, 'true', 7 * 24 * 3600 );
				}


$spacing, $benchmarks and $needed seem to be local variables in self::editSpacingCheck(). As far as I can see there are no such variables in the current scope. Or are there?
Comment 1 lampak 2010-10-12 21:06:54 UTC
BTW: 
$wgMemc->set( $APSkipKey, 'true', 3600 * 24 * $spacing * ( $benchmarks - $needed - 1 ) );

Isn't $benchmarks less than $needed?
Comment 2 Rob Lanphier 2010-10-12 21:50:13 UTC
This all looks like some fairly old code, so if it's broken, it's been broken for a while.  That said, I agree that it looks like there might be some scope problems with $spacing, $benchmarks and $needed (at a minimum, there's an explode statement or something that needs a comment explaining where the variables come from)

I'm leaving this assigned to myself for now, but will reassign when we're not in a release crunch.
Comment 3 Aaron Schulz 2010-10-13 01:28:33 UTC
Probably crept in when editSpacingCheck was made it's own function. This just seems to make should-be negative cache hits not hit. Fixing this now.
Comment 4 Aaron Schulz 2010-10-13 01:47:51 UTC
(In reply to comment #0)
> Actually I'm not sure if I'm not wrong, because I thought something like this
> should cause a crash, so maybe it's ok, but...
> 
>                 $pass = self::editSpacingCheck(
>                     $wgFlaggedRevsAutoconfirm['spacing'],
>                     $wgFlaggedRevsAutoconfirm['benchmarks'],
>                     $user
>                 );
>                 # Make a key to store the results
>                 if ( !$pass ) {
>                     $wgMemc->set( $APSkipKey, 'true',
>                         3600 * 24 * $spacing * ( $benchmarks - $needed - 1 ) );
>                     return true;
>                 } else {
>                     $wgMemc->set( $sTestKey, 'true', 7 * 24 * 3600 );
>                 }
> 
> 
> $spacing, $benchmarks and $needed seem to be local variables in
> self::editSpacingCheck(). As far as I can see there are no such variables in
> the current scope. Or are there?

Fixed in r74710
Comment 5 Aaron Schulz 2010-10-13 01:53:39 UTC
(In reply to comment #1)
> BTW: 
> $wgMemc->set( $APSkipKey, 'true', 3600 * 24 * $spacing * ( $benchmarks -
> $needed - 1 ) );
> 
> Isn't $benchmarks less than $needed?

Also inadvertently fixed in r74710. Those were obviously backwards.

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


Navigation
Links