Skip to content
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

Requiring or including a file again after modification loads old code #3701

Closed
adlawson opened this issue Sep 8, 2014 · 1 comment
Closed

Comments

@adlawson
Copy link

adlawson commented Sep 8, 2014

Not a bug as such, as this makes complete sense.
It is however different behaviour to Zend's PHP and should be listed as an incompatibility.

For example, consider a case where you're doing something as god awful as trying to work around eval by writing to disc and then require-ing the file. Now also suppose you save the file with the same filename each time.

function fake_eval($code) {
    file_put_contents('/tmp/derp.php', $code);
    require '/tmp/derp.php';
}

fake_eval('<?php echo "Hello, World!";');
// => Hello, World!

fake_eval('<?php echo "Hello, World! Again.";');
// => Hello, World!

A workaround is obviously either naming the file differently each time or just not doing something so stupid in the first place, but the fact remains that the behaviour is different to Zend's PHP.

Real world use case ->

@SiebelsTim
Copy link
Contributor

duplicate of #1447

potsky added a commit to potsky/PimpMyLog that referenced this issue Oct 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants