Zend Framework

Zend_Amf_Adobe_Introspector works incorrectly for functions with default argument values

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.9.3
  • Component/s: Zend_Amf
  • Labels:
    None

Description

If php file contains following code:

<?php

class Srv{

function myFunc($id="hello")

{ return $id; }

}

and is then introspected using Zend_Amf_Adobe_Introspector the returned XML is:

<?xml version="1.0" encoding="utf-8"?>
<service-description xmlns="http://ns.adobe.com/flex/service-description/2008">
<types />
<operations>
<operation name="myFunc" returnType="Unknown" />
<operation name="myFunc" returnType="Unknown">
<argument name="id" type="Unknown" />
</operation>
</operations>
</service-description>

Clearly this XML is not correct, it contains two different entries for the function "myFunc".

Activity

Hide
Stanislav Malyshev added a comment -

Actually, it is correct. myFunc has two valid signatures - myFunc() and myFunc(string).

Show
Stanislav Malyshev added a comment - Actually, it is correct. myFunc has two valid signatures - myFunc() and myFunc(string).
Hide
Gaurav Priyadarshi added a comment -

Yes. But it would be better if only one signature is returned something like,
<operation name="myFunc" returnType="Unknown">
<argument name="id" defaultvalue="hello" type="Unknown" />

This will help the client, which is introspecting to get the default value.
I will also tell that the argument id already has a default value so may not be passed.

Show
Gaurav Priyadarshi added a comment - Yes. But it would be better if only one signature is returned something like, <operation name="myFunc" returnType="Unknown"> <argument name="id" defaultvalue="hello" type="Unknown" /> This will help the client, which is introspecting to get the default value. I will also tell that the argument id already has a default value so may not be passed.
Hide
Stanislav Malyshev added a comment -

Fixed by rev. 18086 in trunk - added default value
http://framework.zend.com/code/changelog/Standard_Library/?cs=18086

Show
Stanislav Malyshev added a comment - Fixed by rev. 18086 in trunk - added default value http://framework.zend.com/code/changelog/Standard_Library/?cs=18086
Hide
Gaurav Priyadarshi added a comment -

The issue is not fixed in Zend Framework 1.9.4 and 1.9.5
Looks like the fix did not make into these builds, although the bug says that it got fixed in 1.9.3

Show
Gaurav Priyadarshi added a comment - The issue is not fixed in Zend Framework 1.9.4 and 1.9.5 Looks like the fix did not make into these builds, although the bug says that it got fixed in 1.9.3

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: