php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57647 Megic Methods in Service Descriptions
Submitted: 2007-05-04 09:16 UTC Modified: 2007-05-14 06:54 UTC
From: michael dot caplan at henryschein dot com Assigned: slaws (profile)
Status: Closed Package: SCA_SDO (PECL)
PHP Version: 5.2.1 OS: CentOS 4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: michael dot caplan at henryschein dot com
New email:
PHP Version: OS:

 

 [2007-05-04 09:16 UTC] michael dot caplan at henryschein dot com
Description:
------------
If possible, I think all magic methods (http://www.php.net/manual/en/language.oop5.magic.php) should be suppressed from generated service descriptions, as well as suppressed in the serive request handler (should a client try and call a magic method).  For example, my service class implements a constructor, and this is being picked up by the WSDL generator.

Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns2="http://LabnetOnline001" xmlns:tns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns3="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://LabnetOnline001">
  <types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
      targetNamespace="http://LabnetOnline001"
      elementFormDefault="qualified">
      <xs:element name="__construct">
        <xs:complexType>
          <xs:sequence>
          </xs:sequence>
        </xs:complexType>
      </xs:element>

      <xs:element name="__constructResponse">
        <xs:complexType>
          <xs:sequence>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="rot13">
        <xs:complexType>
          <xs:sequence>

            <xs:element name="toencode" type="xs:string" nillable="true"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="rot13Response">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="rot13Return" type="xs:string" nillable="true"/>
          </xs:sequence>

        </xs:complexType>
      </xs:element>
    </xs:schema>
  </types>

  <message name="__constructRequest">
    <part name="__constructRequest" element="tns2:__construct"/>
  </message>
  <message name="__constructResponse">

    <part name="return" element="tns2:__constructResponse"/>
  </message>
  <message name="rot13Request">
    <part name="rot13Request" element="tns2:rot13"/>
  </message>
  <message name="rot13Response">
    <part name="return" element="tns2:rot13Response"/>
  </message>
  <portType name="LabnetOnline001PortType">

    <operation name="__construct">
      <input message="tns2:__constructRequest"/>
      <output message="tns2:__constructResponse"/>
    </operation>
    <operation name="rot13">
      <input message="tns2:rot13Request"/>
      <output message="tns2:rot13Response"/>
    </operation>
  </portType>

  <binding name="LabnetOnline001Binding" type="tns2:LabnetOnline001PortType">
    <operation name="__construct">
      <input>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>
      </input>
      <output>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>
      </output>
      <tns3:operation xsi:type="tns3:tOperation" soapAction=""/>

    </operation>
    <operation name="rot13">
      <input>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>
      </input>
      <output>
        <tns3:body xsi:type="tns3:tBody" use="literal"/>
      </output>
      <tns3:operation xsi:type="tns3:tOperation" soapAction=""/>

    </operation>
    <tns3:binding xsi:type="tns3:tBinding" transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
  </binding>
  <service name="LabnetOnline001Service">
    <port name="LabnetOnline001Port" binding="tns2:LabnetOnline001Binding">
      <tns3:address xsi:type="tns3:tAddress" location="http://sandbox.int.labnet.net/michael/labnet_online/api/public_html/online001/index.php"/>
    </port>
  </service>
</definitions>

<!-- this line identifies this file as WSDL generated by SCA for PHP. Do not remove -->

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-11 07:57 UTC] cem@php.net
I agree with the originator - special methods should be excluded.
 [2007-05-11 11:56 UTC] michael dot caplan at henryschein dot com
The following diff implements a simple check in SCA_Helper::filterMethods() for '__' in method names, skipping them over.



Index: Z:/michael/labnet_online/api/lib/SCA/SCA_Helper.php
===================================================================
--- Z:/michael/labnet_online/api/lib/SCA/SCA_Helper.php	(revision 197)
+++ Z:/michael/labnet_online/api/lib/SCA/SCA_Helper.php	(working copy)
@@ -233,6 +233,10 @@
 
             /* Check every public method ....                                      */
             for ( $i = 0 ; $i < $elements ; $i++ ) {
+                if ((substr($public_list[ $i ], 0, 2) === '__')) {
+                    continue;
+                }
+
                 /*  ... has a reflection object ....                               */
                 foreach ( $allMethodsArray as $allMethod ) {
                     $objArray = get_object_vars($allMethod);
 [2007-05-14 06:54 UTC] simonslaws at googlemail dot com
Thanks Mike, I put a fix in SCA_Helper.php and introduced a test in SCA/phpunit/WSDLGeneration/SCA_WSDLTest.php in the DUNLIN branch.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jan 26 22:03:57 2022 UTC