antecedent / patchwork

Method redefinition (monkey-patching) functionality for PHP.
https://antecedent.github.io/patchwork/
MIT License
444 stars 40 forks source link

Could it be possible to patch a complete php file? #22

Closed tomolimo closed 7 years ago

tomolimo commented 9 years ago

Hello, First: thank you for your great (and marvelous) job! Second: request explanations: I would like to patch a complete PHP file, how is it possible to do so? Could it be included in next release? Thank you, Regards, Tomolimo

antecedent commented 9 years ago

Hi,

Thank you :), but I'm unsure what was meant by patching a complete PHP file. Is it:

tomolimo commented 9 years ago

Hello, In fact I've got php files that are served by a web server, and I would like to patch these files. i.e.: instead of file x.php I would like the web server to execute the patched version of it.

But the more I’m thinking to it the more I believe that Patchwork can’t do that, due to the fact that execution of Patchwork can’t precede the execution of the PHP script x.php… Or is there a way to tell the PHP interpreter that it should start executing Patchwork, before any other scripts?

Do you confirm ?

Thank you, Regards, Tomolimo

ktomk commented 7 years ago

the feedback is late, see auto_prepend_file PHP ini setting which you can use to setup patchwork before any php script.

tomolimo commented 7 years ago

Thank you anyway, I didn't know this PHP feature, regards, Tomolimo