I want to eval()
to make the function that calls it to end as well. But I don't want to stop the entire application.
I am using include to include an third party application into my own application. The third party application eventually calls a function that first allows me to inject code via a hook, end then at the end of the function it simply calls exit();
.
I don't want to edit their code manually. And I also don't want to include the third party application using exec() or readfile() or curl() or include over http or any other similar method. Because I want the client context to stay existing toward the third party script. (Otherwise, the third party script will think that my own server is the client. For example, the third party script will always see that $_SERVER['REMOTE_ADDR']
is 127.0.0.1
. And I don't want that.)
In short, the following is happening:
My application:
// do stuff
// ...
chdir("path/to/third/party/application");
include ("path/to/third/party/application/index.php");
chdir("path/to/my/application");
// ...
// do more stuff
Third party application:
// do some stuff
// ...
doLastStuff();
function doLastStuff() {
// doing some last stuff
// ...
$hook = "..."; // get code from database
if ($hook) {
eval($hook);
}
exit();
}
The problem is that the exit();
at the end also stops my own script. And I don't want that. Can anyone see a way to stop to avoid that exit()
stopping my script as well, from inside the hook?
I can put what ever string inside $hook.