-
Notifications
You must be signed in to change notification settings - Fork 8k
ext/phar: inject timestamp for flushing #20577
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: master
Are you sure you want to change the base?
Conversation
The objective of this is to potentially allow userland to set the timestamp to allow building reproducible phars
|
Thanks for this ! If I understand correctly, getting time from |
|
I also had this to deal with userland objects & reproducible phars, that came from a discussion in another's repo. #14143 I'd have to think how this all fits together with reproducibility etc and if this is the "easiest" way etc... |
|
I vaguely remember #14143, I admit I'm a bit lost there I would need to dig back into that. But vague understanding is that it is about getting the correct value for the timestamp instead whatever value the PHAR was created at. My naïve understand of the issue is that at the moment when you build a PHAR there is simply no API to set the timestamp. For context, what most people use in practice in PHP land is use seld/phar-utils which reads the file and look up at the position to directly update the timestamp there, with the caveat that it needs to re-sign the PHAR. So ideally would be cool to simply be able to do |
| if (SUCCESS == spl_iterator_apply(obj, (spl_iterator_apply_func_t) phar_build, (void *) &pass)) { | ||
| phar_obj->archive->ufp = pass.fp; | ||
| phar_flush(phar_obj->archive, &error); | ||
| // TODO: Set to &pass; struct? |
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.
Over 9000!
IIUC that belongs to PHP script code getenv()/$_SERVER/etc. calls, correct.
^ this is what you normally want. and here it goes in (if it makes it). this is great! @drupol /E: current example there (ref)
|
The PR allows you to override the implementations of getMTime() etc such that they are called instead of using the default one.
Right. And setTimestamp() on its own is likely not enough. Ideally you have setTimestamp() on the Phar class itself, and also a setMTime() for the phar file info object.
That's a bit ad-hoc and won't cover phars built by other means. |
The objective of this is to potentially allow userland to set the timestamp to allow building reproducible phars.
People this might interest in the long run: