[MediaWiki-l] switch($X){case 'Y':trigger_error("can you believe \$X is NOT Y but Z"); }

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[MediaWiki-l] switch($X){case 'Y':trigger_error("can you believe \$X is NOT Y but Z"); }

jidanni
In LocalSettings.php I put

switch($wgSitename){case 'ABJ':
    trigger_error("can you believe \$wgSitename is $wgSitename and not ABJ?!",E_USER_WARNING);}

For each HTTP GET, I see in /var/log/apache2/error.log:

[Fri Jan 03 15:48:43.103883 2014] [:error] [pid 6608] [client 127.0.0.1:52043] PHP Warning:  can you believe $wgSitename is ABJ and not ABJ?! in /home/jidanni/mediawiki/LocalSettings.php on line 28
 PHP Warning:  can you believe $wgSitename is 0 and not ABJ?! in /home/jidanni/mediawiki/LocalSettings.php on line 28

So there is apparently two runs going on per each one HTTP GET.

But how in the world does it execution happen for the second run inside the case statement's ABJ
switch if at the same time it is 0?

Or is this some weird php/apache echoing?

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: switch($X){case 'Y':trigger_error("can you believe \$X is NOT Y but Z"); }

Daniel Friesen-2
On 2014-01-03 2:37 AM, [hidden email] wrote:
> Or is this some weird php/apache echoing?
You can test whether it is or isn't by adding an mt_rand() call to your
log test.

~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]


_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: switch($X){case 'Y':trigger_error("can you believe \$X is NOT Y but Z"); }

jidanni
DF> You can test whether it is or isn't by adding an mt_rand() call to your log test.
You would have to tell me how. But anyway I've isolated the problem:
$ cat n.php
<?php
$wgSitename='ABJ';
$wgSitename=0;
switch($wgSitename){case 'ABJ':trigger_error("can you believe \$wgSitename is $wgSitename and not ABJ?!",E_USER_WARNING);}
$wgSitename=0;
$wgSitename='ABJ';
switch($wgSitename){case 0:trigger_error("can you believe \$wgSitename is $wgSitename and not 0?!",E_USER_WARNING);}
$ php n.php
PHP Warning:  can you believe $wgSitename is 0 and not ABJ?! in /mnt/usb/cf/n.php on line 4
PHP Warning:  can you believe $wgSitename is ABJ and not 0?! in /mnt/usb/cf/n.php on line 7

What in the world is going on? Thank you. PHP 5.5.7-2.

_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: switch($X){case 'Y':trigger_error("can you believe \$X is NOT Y but Z"); }

jidanni