Last modified: 2013-09-04 11:53:07 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 T37274, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35274 - includes/memcached-client.php constants have incorrect scope
includes/memcached-client.php constants have incorrect scope
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.17.x
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-17 00:23 UTC by Daniel Widdis
Modified: 2013-09-04 11:53 UTC (History)
0 users

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


Attachments

Description Daniel Widdis 2012-03-17 00:23:59 UTC
I encountered a problem exhibited in the latest version of the TableEdit extension on the latest svn version of MW 1.17.  The root cause of the problem is that the constants defined in the memcached-client.php include file are not properly interpreted.

Problematic file is:
http://svn.wikimedia.org/viewvc/mediawiki/branches/REL1_17/phase3/includes/memcached-client.php?view=markup

Error message is:
Fatal error: Undefined class constant 'COMPRESSED' in /<path>/includes/memcached-client.php on line 973

(Similar error for COMPRESSION_SAVINGS.  I didn't encounter the SERIALIZED error but might have if I had gone down a different branch of code.)

In the problematic lines, the constants are referred to using self::, i.e., self::COMPRESSED, self::COMPRESSION_SAVINGS, and self::SERIALIZED

self:: refers to the scope at the point of definition not at the point of execution.  This is problematic in an include file.

For PHP 5.3+, the correct syntax is to use static:: to refer to the constants.
Comment 1 Sam Reed (reedy) 2012-03-17 00:32:25 UTC
(In reply to comment #0) 
> For PHP 5.3+, the correct syntax is to use static:: to refer to the constants.

Our minimum supported version of PHP is still 5.2.3, so we cannot use LSB stuff in core.

Also, self is still valid syntax: http://php.net/manual/en/language.oop5.constants.php

MediaWiki 1.17 isn't a currently supported release, and as this extension isn't kept and maintained in our SVN repository,

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


Navigation
Links