Details
Description
We are facing an issue with the gateway.php that we use as endpoint for Remoting Calls from Flash player.
In order to use a php file as a service we need to include it in the gateway.php file.
Now if you have two php files exposed as services the gateway.php file has a code snippet similar to:
require_once 'Zend/Amf/Server.php';
require_once 'a.php';
require_once 'b.php';
$server = new Zend_Amf_Server();
echo $server->handle();
where a.php & b.php are service php files.
Now if a.php is invalid (syntactical errors etc.) the user is not allowed to invoke the functions of even b.php, since the gateway.php file could not include the invalid a.php file and hence throws an error.
This is a concern as the user will now have to make sure that all the files exposed as services need to be valid all the time.
Is there any other better way of exposing the service php files so that the above limitations don't show up.
I don't think there's something specific to AMF - if you load bad file, PHP stops execution and produces an error. There's little that can be done about it.
However, in this particular case you could use autoloading and then when you run service from a.php you would not need to include b.php. Thus, only service using b.php would be broken when b.php is broken.