ZF-1949: A blank page appears if there's any missing method's argument.
Description
A blank page appears if there's any missing method's argument when calling from a url (sent as HTTP GET variables)
This issue appears when application reaches this line:
throw new Zend_Rest_Server_Exception('Invalid Method Call to ' . $this->_method . '. Requires ' . count($func_args) . ', ' . count($calling_args) . ' given.', 400);
If I replace that line with:
throw new Exception("Fails in line 149");
A blank page appears again, but if I error message is echoed everything works just fine.
File Zend/REST/Server.php line 149
I thought it was caused because of a php fatal error, but I don't find that yet.
I've had this issue in two different hosts:
Solaris 10 Apache 2 PHP 5.2.1
CentOS Apache 2 PHP 5.2.1
Here's my testing code:
service PHP
<?php
ini_set('error_reporting', E_ALL);
require_once 'Zend/Rest/Server.php';
require_once 'test.php';
$server = new Zend_Rest_Server();
$server->setClass('test');
$server->handle();
?>
Test.php
<?php
class test
{
/**
* Test Method
*
* @param string $to
* @param string $say
* @return bool
*/
public function sayHi($to, $say)
{
return "Good $say, $to";
}
}
?>
Comments
Posted by Darby Felton (darby) on 2007-09-18T13:12:31.000+0000
Assigning to [~davey] to initiate issue review
Posted by Matthew Weier O'Phinney (matthew) on 2007-09-20T12:43:40.000+0000
This is a simple case of an uncaught exception, that, because you must have display_errors off, results in no return content. The question is whether Zend_Rest_Server should do more exception handling and have a standard type of error response when exceptions are detected; I will discuss this with Davey.
Posted by Darby Felton (darby) on 2007-09-20T14:00:27.000+0000
Reducing priority to minor, since using a {{try...catch()}} block appears to be an easy workaround.
Posted by Eric Coleman (eric) on 2007-10-31T11:21:59.000+0000
This issue occurs -even- if a method has default arguments...
Change davey's example to test class to public function sayHi($to = null, $say = null)
Here's a fix:
Posted by Matthew Weier O'Phinney (matthew) on 2008-05-09T11:59:06.000+0000
Scheduling for next mini release.
Posted by Matthew Weier O'Phinney (matthew) on 2008-07-24T04:21:16.000+0000
Fixes for both the case of missing required and missing optional arguments have been committed to trunk and 1.5 and 1.6 release branches.