Opened 9 years ago
Last modified 5 years ago
#33034 new enhancement
Refactor SCRIPT_FILENAME ending with php.cgi check in load.php
Reported by: | wildpeat | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.3 |
Component: | Bootstrap/Load | Keywords: | |
Focuses: | Cc: |
Description
I found the original check pretty confusing :)
Attachments (1)
Change History (3)
#1
@
9 years ago
To avoid the usage of a regular expression here, this seems far more readable than the current odd code:
if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && 'php.cgi' == substr( $_SERVER['SCRIPT_FILENAME'], -7 ) )
#2
@
9 years ago
With the caveat that I'm brand new to PHP, I agree that's more readable than the original, but I don't like the constant -7 in the code. I have noticed this hardcoding of the string length in lots of other parts of the code-base and I'll gladly nod to your experience if this is more idiomatic in PHP than the regex.
Cheers for looking!
Note: See
TracTickets for help on using
tickets.
Patch