User "Afeldman" posted a comment on MediaWiki.r97687.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97687#c22935
Commit summary:

bug 31052 : live hack to support reading from old non-slave external store 
servers

Comment:

I think I actually need to use in_array() in this case but don't worry, 
$wgDefaultExternalStore is generally only going to contain 0 or 1 elements.  

The WMF db.php contains:

$wgDefaultExternalStore = array( 
        'DB://cluster22',
);

isset will return false since the key isn't assigned to a non-null value, but 
in a test with php 5.3.6, array_key_exists also returns false, unless the key 
is explicitly assigned to null.  Seems like a php bug to me, but only 
in_array() works as I'd expect in this case.

$ php -r '$test = array("abc123"); if ( array_key_exists("abc123", $test) ) { 
echo "true\n"; } else { echo "false\n"; }'
false

$ php -r '$test = array("abc123"=>NULL); if ( array_key_exists("abc123", $test) 
) { echo "true\n"; } else { echo "false\n"; }'
true



_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to