Difference between die(_("Access Denied")) and just die("Access Denied")

Permalink
I remember reading something somewhere but I can't find it. At some point the die statement was changed from
<?php  defined('C5_EXECUTE') or die(_("Access Denied."));?>
to
<?php  defined('C5_EXECUTE') or die("Access Denied."); ?>

Can someone explain to me the difference? What was that underscore for in the first place, and what bit of code got updated to allow the die statement to work without an underscore?

Perhaps it has something to do with becoming more PSR compliant? According to http://www.php-fig.org/psr/psr-2/:...
Property names SHOULD NOT be prefixed with a single underscore to indicate protected or private visibility.

ob7dev
 
Gondwana replied on at Permalink Reply
Gondwana
I think this is a php localisation thing:
http://php.net/manual/en/function.gettext.php...

c5's _t() seems parallel.
ob7dev replied on at Permalink Reply
ob7dev
So if its a localization thing, why did the core switch from using an underscore to no underscore? Does that mean "Access Denied" will always be displayed in English?
Gondwana replied on at Permalink Reply
Gondwana
I can't speak for the core team, but I assume the core team doesn't intend for php's localisation to be used for c5 deployments. As you say, the result is that the message would always be displayed in the language given. The c5 alternative would probably be something like
die(_t("Access denied."));
ob7dev replied on at Permalink Reply
ob7dev
I believe its just
die(_("Access Denied."));
Gondwana replied on at Permalink Reply
Gondwana
Yes, but only if php's localisation were being used. If c5's localisation is used, I think it would need to be _t or one of its variants.
ob7dev replied on at Permalink Reply
ob7dev
But the way the core use to do it is 'die(_("Access Denied' .... What do you think is the reason they switched it to no underscore?
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
@mnkras explained it here
http://www.concrete5.org/developers/beta/marketplace-community-revi...

At the time any illegal access is made, _ is unlikely to exist, so it wouldn't work anyway. Hence it may as well be die('Access Denied').

However, using _ is not a major issue because anyone getting a code error because _ doesn't exist is likely to be accessing a site illegally anyway. So who cares if they get a code error?