[fw-general] Zend_Server_Reflection don't work with interfaces.

2008-09-11 Thread a_d_j_i

Hi. 
I'm using Zend Soap Autodiscovery and want to do autodicover over an php
interface (I think is a good idea because I want to export only some methods
of my class, and also it give me a more nice way to declare the client and
server class interfaces). When I pass the interface name to the autodiscover
class->setClass I get an error in the relfection code.
I solved this problem adding two lines (see below) in the code and want to
know if there is a problem with my modification and if there is a way to
patch the framework code ?

Thank in advance [EMAIL PROTECTED]

{
if (is_object($class)) {
$reflection = new ReflectionObject($class);
} elseif (interface_exists($class)) {
$reflection = new ReflectionClass($class);
} elseif (class_exists($class)) {
$reflection = new ReflectionClass($class);
} else {
throw new Zend_Server_Reflection_Exception('Invalid class or
object passed to attachClass()');
}

-- 
View this message in context: 
http://www.nabble.com/Zend_Server_Reflection-don%27t-work-with-interfaces.-tp19435866p19435866.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Server_Reflection

2007-06-06 Thread PotatoBob

http://framework.zend.com/issues/browse/ZF-1499


Matthew Weier O'Phinney-3 wrote:
> 
> -- PotatoBob <[EMAIL PROTECTED]> wrote
> (on Saturday, 26 May 2007, 07:10 PM -0700):
>> There seems to be a problem that I've found when brought up by someone on
>> #
>> zftalk. It seems that Zend_Server_Reflection has problems with the use of
>> func_get_args() when there is an @param php doc stating extra params.
> 
> This will be difficult to resolve; Zend_Server_Reflection iterates
> through the params in the docblock and then uses PHP's Reflection API to
> determine additional information (default values, whether or not it's
> optional, type hints, etc.); if the Reflection API has no knowledge of
> the param, you'll get errors like this.
> 
> However, I can probably add some logic to check first that the parameter
> is found by Reflection, and if not, mark it as optional.
> 
> Could you log this as an issue in JIRA for me so I can track it better?
> 
> Thanks!
> 
>> Example:
>> /**
>> * Internally redirects one action to another
>> *
>> * @param string $action The new action to be redirected to
>> * @param mixed Any other parameters passed to this method will be passed
>> as
>> * parameters to the new action.
>> * @access public
>> */
>> function setAction($action) {
>> $this->action = $action;
>> $args = func_get_args();
>> unset($args[0]);
>> call_user_func_array(array(&$this, $action), $args);
>> }
>> 
>> Error msg: ( ! ) Fatal error: Call to a member function isOptional() on a
>> non-object in Zend/Server/Reflection/Function/Abstract.php on line 346
> 
> -- 
> Matthew Weier O'Phinney
> PHP Developer| [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Server_Reflection-tf3822461s16154.html#a10998398
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Server_Reflection

2007-05-28 Thread André Hoffmann

Also there seems to be a problem with optional parameters. If I use SOAP
auto-discovery with a function like this:

class foo
{
 public function bar(blah=null)
 {
   ...
 }
}

The function appears twice in the WSDL causing the SOAP-Client to raise an
error.
When I remove the =null part everything works fine.

On 5/27/07, PotatoBob <[EMAIL PROTECTED]> wrote:





Matthew Weier O'Phinney-3 wrote:
>
> -- PotatoBob <[EMAIL PROTECTED]> wrote
> (on Saturday, 26 May 2007, 07:10 PM -0700):
>> There seems to be a problem that I've found when brought up by someone
on
>> #
>> zftalk. It seems that Zend_Server_Reflection has problems with the use
of
>> func_get_args() when there is an @param php doc stating extra params.
>
> This will be difficult to resolve; Zend_Server_Reflection iterates
> through the params in the docblock and then uses PHP's Reflection API to
> determine additional information (default values, whether or not it's
> optional, type hints, etc.); if the Reflection API has no knowledge of
> the param, you'll get errors like this.
>
> However, I can probably add some logic to check first that the parameter
> is found by Reflection, and if not, mark it as optional.
>
> Could you log this as an issue in JIRA for me so I can track it better?
>
> Thanks!
>
>> Example:
>> /**
>> * Internally redirects one action to another
>> *
>> * @param string $action The new action to be redirected to
>> * @param mixed Any other parameters passed to this method will be
passed
>> as
>> * parameters to the new action.
>> * @access public
>> */
>> function setAction($action) {
>> $this->action = $action;
>> $args = func_get_args();
>> unset($args[0]);
>> call_user_func_array(array(&$this, $action), $args);
>> }
>>
>> Error msg: ( ! ) Fatal error: Call to a member function isOptional() on
a
>> non-object in Zend/Server/Reflection/Function/Abstract.php on line 346
>
> --
> Matthew Weier O'Phinney
> PHP Developer| [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
>
>

Unfortunately I don't have a jira account otherwise I would of posted one
already :S

--
View this message in context:
http://www.nabble.com/Zend_Server_Reflection-tf3822461s16154.html#a10827860
Sent from the Zend Framework mailing list archive at Nabble.com.





--
best regards,
André Hoffmann


Re: [fw-general] Zend_Server_Reflection

2007-05-27 Thread PotatoBob



Matthew Weier O'Phinney-3 wrote:
> 
> -- PotatoBob <[EMAIL PROTECTED]> wrote
> (on Saturday, 26 May 2007, 07:10 PM -0700):
>> There seems to be a problem that I've found when brought up by someone on
>> #
>> zftalk. It seems that Zend_Server_Reflection has problems with the use of
>> func_get_args() when there is an @param php doc stating extra params.
> 
> This will be difficult to resolve; Zend_Server_Reflection iterates
> through the params in the docblock and then uses PHP's Reflection API to
> determine additional information (default values, whether or not it's
> optional, type hints, etc.); if the Reflection API has no knowledge of
> the param, you'll get errors like this.
> 
> However, I can probably add some logic to check first that the parameter
> is found by Reflection, and if not, mark it as optional.
> 
> Could you log this as an issue in JIRA for me so I can track it better?
> 
> Thanks!
> 
>> Example:
>> /**
>> * Internally redirects one action to another
>> *
>> * @param string $action The new action to be redirected to
>> * @param mixed Any other parameters passed to this method will be passed
>> as
>> * parameters to the new action.
>> * @access public
>> */
>> function setAction($action) {
>> $this->action = $action;
>> $args = func_get_args();
>> unset($args[0]);
>> call_user_func_array(array(&$this, $action), $args);
>> }
>> 
>> Error msg: ( ! ) Fatal error: Call to a member function isOptional() on a
>> non-object in Zend/Server/Reflection/Function/Abstract.php on line 346
> 
> -- 
> Matthew Weier O'Phinney
> PHP Developer| [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
> 
> 

Unfortunately I don't have a jira account otherwise I would of posted one
already :S

-- 
View this message in context: 
http://www.nabble.com/Zend_Server_Reflection-tf3822461s16154.html#a10827860
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Server_Reflection

2007-05-27 Thread Matthew Weier O'Phinney
-- PotatoBob <[EMAIL PROTECTED]> wrote
(on Saturday, 26 May 2007, 07:10 PM -0700):
> There seems to be a problem that I've found when brought up by someone on #
> zftalk. It seems that Zend_Server_Reflection has problems with the use of
> func_get_args() when there is an @param php doc stating extra params.

This will be difficult to resolve; Zend_Server_Reflection iterates
through the params in the docblock and then uses PHP's Reflection API to
determine additional information (default values, whether or not it's
optional, type hints, etc.); if the Reflection API has no knowledge of
the param, you'll get errors like this.

However, I can probably add some logic to check first that the parameter
is found by Reflection, and if not, mark it as optional.

Could you log this as an issue in JIRA for me so I can track it better?

Thanks!

> Example:
> /**
> * Internally redirects one action to another
> *
> * @param string $action The new action to be redirected to
> * @param mixed Any other parameters passed to this method will be passed as
> * parameters to the new action.
> * @access public
> */
> function setAction($action) {
> $this->action = $action;
> $args = func_get_args();
> unset($args[0]);
> call_user_func_array(array(&$this, $action), $args);
> }
> 
> Error msg: ( ! ) Fatal error: Call to a member function isOptional() on a
> non-object in Zend/Server/Reflection/Function/Abstract.php on line 346

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Zend_Server_Reflection

2007-05-26 Thread PotatoBob

There seems to be a problem that I've found when brought up by someone on
#zftalk. It seems that Zend_Server_Reflection has problems with the use of
func_get_args() when there is an @param php doc stating extra params.

Example:

  /**

  * Internally redirects one action to another

  *

  * @param string $action The new action to be redirected to

  * @param mixed  Any other parameters passed to this method will be passed
as

  *   parameters to the new action.

  * @access public

  */

  function setAction($action) {

  $this->action = $action;

  $args = func_get_args();

  unset($args[0]);

  call_user_func_array(array(&$this, $action), $args);

  }

Error msg: ( ! ) Fatal error: Call to a member function isOptional() on a
non-object in Zend/Server/Reflection/Function/Abstract.php on line 346

---

http://www.spotsec.com SpotSec 
-- 
View this message in context: 
http://www.nabble.com/Zend_Server_Reflection-tf3822461s16154.html#a10821733
Sent from the Zend Framework mailing list archive at Nabble.com.


Re: [fw-general] Zend_Server_Reflection->getDescription confusion

2007-03-14 Thread Matthew Weier O'Phinney
-- Raphael Stolt <[EMAIL PROTECTED]> wrote
(on Tuesday, 13 March 2007, 11:03 PM +0100):
> Does somebody know why 
> Zend_Server_Reflection_Function_Abstract->getDescription
> returns only a part of the PHPDoclet area and not everything? Does it skip the
> @tags?

My assumption when programming the class is that the @tags are for
internal use, not for public consumption. The description stored with
the function/method is likely going to be used to describe or provide
documentation for the service to an end-user API user. A good example
would be somebody calling system.methodHelp() on an XML-RPC method name.

> When reflecting/retrieving the description of an method with an PHPDoclet area
> I only get back "This is the index action." Which would be okay since this is
> the description.
> But by removing 'This is the index action.' from the PHPDoclet area and 
> calling
> the getDescription method I will get "@return void".

Okay, that's a bug. :-). I'll place an issue in the tracker and take
care of it prior to the 0.9 release.

> Is there a way of getting the whole PHPDoclet area by using the
> Zend_Server_Reflection component, or do I have to fall back using
> ReflectionMethod's getDocComment to retrieve it all? Might there
> be a method in Zend_Server_Reflection_Method/
> end_Server_Reflection_Function_Abstract similar to ReflectionMethod's
> getDocComment in the future?

Right now, you'll have to use getDocComment(). If you can make a good
case for storing the entire doc comment in the server reflection object,
I'll consider adding it in a future release.

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Zend_Server_Reflection->getDescription confusion

2007-03-13 Thread Raphael Stolt
Hello Everybody.

Does somebody know why Zend_Server_Reflection_Function_Abstract->getDescription 
returns only a part of the PHPDoclet area and not everything? Does it skip the 
@tags?

When reflecting/retrieving the description of an method with an PHPDoclet area 
I only get back "This is the index action." Which would be okay since this is 
the description. 
But by removing 'This is the index action.' from the PHPDoclet area and calling 
the getDescription method I will get "@return void".

Example method:

/**
 * This is the index action.
 * @return void
 */
public function indexAction() {
$view = Zend::registry('view');
$view->assign('title', 'The title of the application');
echo $view->render('index.php');
}

Reflection using Zend_Server_Reflection:

$class = Zend_Server_Reflection::reflectClass($controller);
$method = new Zend_Server_Reflection_Method($class, new 
ReflectionMethod($controller,'indexAction'));
$description = $method->getDescription();

> This is the index action.

Reflection using ReflectionMethod:

$method = new ReflectionMethod($controller,'indexAction');
$description = $method->getDocComment();

> /**
   * This is the index action.
   * @return void
   */

Is there a way of getting the whole PHPDoclet area by using the 
Zend_Server_Reflection component, or do I have to fall back using 
ReflectionMethod's getDocComment to retrieve it all? Might there 
be a method in 
Zend_Server_Reflection_Method/end_Server_Reflection_Function_Abstract similar 
to ReflectionMethod's getDocComment in the future? 


Thanks for any reply.

Raphael Stolt