Page MenuHomePhabricator

$contactSender settings bug? None set for $config['SenderEmail'] True
Closed, InvalidPublic

Description

In extension:ContactPage from (January 19, 2016 19:18 +0000) I wonder at line 282
https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FContactPage/master/ContactPage_body.php#L282
at

$contactSender = new MailAddress(
  $config['SenderEmail'] ?: $wgPasswordSender,
  $config['SenderName']
);

should it not read:

$config['SenderEmail'] ? $config['SenderEmail'] : $wgPasswordSender

?

Event Timeline

infinite-dao raised the priority of this task from to Needs Triage.
infinite-dao updated the task description. (Show Details)
infinite-dao subscribed.

The code example you posted uses the shorthand ternary operator, introduced in PHP 5.3. Because MediaWiki requires at least PHP 5.3.3, its usage is allowed. (See Manual:Coding conventions/PHP on MediaWiki.org.)

The code example you posted uses the shorthand ternary operator

OK I thought I knew but you enlightened me ;-) I was unaware that …

php -r '$var="defined"; echo $var ? : "var not defined";'

… gives “defined”, so …

php -r '$var="defined"; echo $var ? $var : "var not defined";'

… issues identical results. Well I guess I have to think twice before posting

Krenair claimed this task.