Opened 11 years ago
Closed 23 months ago
#33034 closed enhancement (duplicate)
Refactor SCRIPT_FILENAME ending with php.cgi check in load.php
| Reported by: | wildpeat | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Bootstrap/Load | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
I found the original check pretty confusing :)
Attachments (1)
Change History (4)
#1
@
11 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
@
11 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Patch