Welcome Guest, Not a member yet? Register   Sign In
SVN change : defining EXT
#1

[eluser]xwero[/eluser]
The latest change is in the index.php file
Code:
define('EXT', '.php');
My first reaction was, if the constant value is a string why not move it to the constants.php file?
#2

[eluser]Dam1an[/eluser]
Bacause of line 115 in index.php?
The EXT value is used for all the other includes, so without it, you can't load codeigniter.php and therefore you can't get the constants.php file
#3

[eluser]xwero[/eluser]
True but if you are going to set the constant with a string isn't that a sign the constant isn't really needed? Who is going to change the extension of all the framework files?
#4

[eluser]jayrulez[/eluser]
why did the php file extention need to be defined in the first place :|
#5

[eluser]Colin Williams[/eluser]
Quote:why did the php file extention need to be defined in the first place :|
There are plenty of reasons. Don't you think if someone had some sort of requirement where they wanted a different extension, they'd scream bloody murder that CI locked them in. It's an example of constantly asking, "What happens if..." while developing, which everyone should do. "What happens if the server should only parse .phtml extensions through the PHP parser?" "What happens if users want to force CI to run as PHP 5, but not legacy code elsewhere, so they use a .php5 extension." Etc.

Quote:True but if you are going to set the constant with a string isn’t that a sign the constant isn’t really needed?

Well, the string should never change, therefore it's a constant. There is also the subject of "developer experience" to take into consideration. For instance, sometimes you would rather have something like

Code:
if ($_SESSION[USER_SESSION_FLAG] == USER_IS_AUTHENTICATED)
than just 'key' == TRUE/FALSE. It may be more verbose but it reads better and is self-documenting.
#6

[eluser]xwero[/eluser]
Sure having the EXT constant gives you a single point of entry, but the change makes it static instead of dynamic. It seems a step back.
#7

[eluser]Colin Williams[/eluser]
How is it made static? It's still in an application-level file. And the EXT constant has been there for a long time now. Maybe all the way back to the first release. It was just moved. Much ado about nothing.
#8

[eluser]xwero[/eluser]
the line was
Code:
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
so with the change you have to change the extension yourself where the bootstrap file was used to extract the extension from.

Just because it is been that way for so long why did it go to a static string?




Theme © iAndrew 2016 - Forum software by © MyBB