-
Notifications
You must be signed in to change notification settings - Fork 8k
phar: use SOURCE_DATE_EPOCH to build PHAR when available
#20570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: PHP-8.3
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -440,6 +440,21 @@ static inline zend_off_t phar_get_fp_offset(phar_entry_info *entry) | |||||
| return PHAR_G(cached_fp)[entry->phar->phar_pos].manifest[entry->manifest_pos].offset; | ||||||
| } | ||||||
|
|
||||||
| static inline time_t source_date_epoch_time(time_t *tloc) | ||||||
| { | ||||||
| const char *sde; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please merge the declarations and assignments, we no longer do C89 |
||||||
| time_t ts; | ||||||
|
|
||||||
| tsrm_env_lock(); | ||||||
| sde = getenv("SOURCE_DATE_EPOCH"); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should use php_getenv, which will do the right thing on Windows and also take care of locking. |
||||||
| ts = (sde) ? strtoul(sde, NULL, 10) : time(0); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| tsrm_env_unlock(); | ||||||
| if (tloc) { | ||||||
| *tloc = ts; | ||||||
| } | ||||||
|
Comment on lines
+452
to
+454
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the API of this function:
I'd say that a rename (for clarity) would be a good idea, and the parameter can perhaps be always gone? |
||||||
| return ts; | ||||||
| } | ||||||
|
|
||||||
| #define PHAR_MIME_PHP '\0' | ||||||
| #define PHAR_MIME_PHPS '\1' | ||||||
| #define PHAR_MIME_OTHER '\2' | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As pointed out by Ocramius, this argument seems not useful.