PHP Warning, nusoap.php on line 4694

Help
2010-07-22
2013-06-06
  • David Martín Clavo

    With the following code:

    require_once('./nusoap-0.9.5/lib/nusoap.php');
    $client = new nusoap_client('https://xxxxxxx?WSDL', true);
    $params = array( .... );
    $result = $client->call('findEgroupByName', $params);
    

    The 'call' method execution gives TWICE this warning:
    PHP Warning:  Attempt to modify property of non-object in xxxx/nusoap-0.9.5/lib/nusoap.php on line 4694

    Line 4694 is the following:
                    $this->schemas->imports = true;

    I didn't find a bug tracker so I post the bug here :)
    Thanks for the nice library, makes SOAP easy for PHP :)

    David

     
  • Benoît Bryon

    Benoît Bryon - 2011-01-31

    Hi,
    I experienced the same issue.
    The following patch solved the problem.
    (currently, I can't figure out how to submit this patch…)

    # HG changeset patch
    # User Benoit Bryon <benoit.bryon@makina-corpus.com>
    # Date 1296484575 -3600
    # Node ID a7c89f843192805148f68bfa1c0dfe9014325171
    # Parent  25beae58ce79daa1c56c3b2135a568e6182e9a6a
    Fixed 'Attempt to modify property of non-object' error in wsdl->fetchWSDL()
    diff --git a/lib/class.wsdl.php b/lib/class.wsdl.php
    --- a/lib/class.wsdl.php
    +++ b/lib/class.wsdl.php
    @@ -104,12 +104,12 @@
                $imported = 0;
                // Schema imports
                foreach ($this->schemas as $ns => $list) {
    -               foreach ($list as $xs) {
    +               foreach ($list as $ilist => $xs) {
                        $wsdlparts = parse_url($this->wsdl);    // this is bogusly simple!
                        foreach ($xs->imports as $ns2 => $list2) {
                            for ($ii = 0; $ii < count($list2); $ii++) {
                                if (! $list2[$ii]['loaded']) {
    -                               $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
    +                               $this->schemas[$ns][$ilist]->imports[$ns2][$ii]['loaded'] = true;
                                    $url = $list2[$ii]['location'];
                                    if ($url != '') {
                                        $urlparts = parse_url($url);
    diff --git a/lib/nusoap.php b/lib/nusoap.php
    --- a/lib/nusoap.php
    +++ b/lib/nusoap.php
    @@ -4686,12 +4686,12 @@
                $imported = 0;
                // Schema imports
                foreach ($this->schemas as $ns => $list) {
    -               foreach ($list as $xs) {
    +               foreach ($list as $ilist => $xs) {
                        $wsdlparts = parse_url($this->wsdl);    // this is bogusly simple!
                        foreach ($xs->imports as $ns2 => $list2) {
                            for ($ii = 0; $ii < count($list2); $ii++) {
                                if (! $list2[$ii]['loaded']) {
    -                               $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
    +                               $this->schemas[$ns][$ilist]->imports[$ns2][$ii]['loaded'] = true;
                                    $url = $list2[$ii]['location'];
                                    if ($url != '') {
                                        $urlparts = parse_url($url);
    
     
  • Scott Nichol

    Scott Nichol - 2011-01-31

    Thanks for submitting this patch.  In order for me to verify it, I need some WSDL that causes the PHP warning in the existing code but which this patch fixes.  Can either of you supply me this WSDL (either as file(s) or URL)?  Thanks.

     
  • Benoît Bryon

    Benoît Bryon - 2011-01-31

    I guess it should appear everytime $xs->imports has elements.
    In the code extract, "$this->schemas" refers to "$list", which is an array. So it does not have a "import" property.

    I cannot provide the WSDL I am using because of confidentiality agreement.
    So I will look for some public WSDL with imports tomorrow, see if I reproduce the problem, then come back here.

     
  • Benoît Bryon

    Benoît Bryon - 2011-02-01

    I reproduced the warning with the following wsdl:
    http://www.restfulwebservices.net/wcf/GeoIPService.svc?wsdl

    Code used:

    <?php
    require_once('../lib/nusoap.php');
    $client = new nusoap_client('http://www.restfulwebservices.net/wcf/GeoIPService.svc?wsdl', 'wsdl');
    $client->loadWSDL();
    ?>
    

    The WSDL contains some "xsd:import" directives.

     
  • Anonymous - 2011-02-17

    I applied that patch. So, I don't see any warnings. But looks like nusoap doesn't parse correctly included XSD file. Because nusoap doesn't add passed parameters to the generated XML. Any idea how to fix that?

     
  • Erik ANET

    Erik ANET - 2011-11-25

    I have the same issue. ¿Where do I apply that patch?¿On nusoap.php? I'm newbie in nusoap and I don't know…
    Thanks!

     
  • Krlos.Loor

    Krlos.Loor - 2012-05-28

    but instead of
    $ This-> schemas  -> Imports    = true;
    because it is only just.
    $ This-> schemas   -> Imports    = true;

    We worked well ….

        / / Old function
    / *
        $ Imported = 0;
        / / Schema Imports
        foreach ($ this-> schemas as $ ns => $ list) {
        foreach ($ list as $ xs) {
    $ Wsdlparts = parse_url ($ this-> wsdl) / / this is bogusly simple!
    foreach ($ xs-> Imports as $ ns2 => $ list2) {
    for ($ i = 0; $ ii <count ($ list2) $ ii + +) {
    if ($ list2  ) {
    $ This-> schemas  -> Imports    = true;
    $ Url = $ list2  ;
    if ($ url! ='') {
    $ Urlparts = parse_url ($ url);
    if (isset ($ urlparts )) {
    $ Url = $ wsdlparts . ':/ /'. $ Wsdlparts . (Isset ($ wsdlparts )? ':'. $ Wsdlparts :'').
    substr ($ wsdlparts , 0, strrpos ($ wsdlparts , '/') + 1). $ urlparts ;
    }
    if (in_array ($ url, $ imported_urls)) {
    $ This-> parseWSDL ($ url);
    $ Imported + +;
    $ Imported_urls  = $ url;
    }
    Else {}
    $ This-> debug ("Unexpected scenario: empty URL for unloaded import");
    }
    }
    }
    }
        }
        }
        / / End of the old function
    * /
        / / Function Patch
    $ Imported = 0;
         / / Schema Imports
         foreach ($ this-> schemas as $ ns => $ list) {
        foreach ($ list as $ xs) {
        foreach ($ list as $ ilist => $ xs) {
    $ Wsdlparts = parse_url ($ this-> wsdl) / / this is bogusly simple!
    foreach ($ xs-> Imports as $ ns2 => $ list2) {
    for ($ i = 0; $ ii <count ($ list2) $ ii + +) {
    if ($ list2  ) {
    / / $ This-> schemas  -> Imports    = true;
    $ This-> schemas   -> Imports    = true;
    $ Url = $ list2  ;
    if ($ url! ='') {
    $ Urlparts = parse_url ($ url);
    if (isset ($ urlparts )) {
    $ Url = $ wsdlparts . ':/ /'. $ Wsdlparts . (Isset ($ wsdlparts )? ':'. $ Wsdlparts :'').
    substr ($ wsdlparts , 0, strrpos ($ wsdlparts , '/') + 1). $ urlparts ;
    }
    if (in_array ($ url, $ imported_urls)) {
    $ This-> parseWSDL ($ url);
    $ Imported + +;
    $ Imported_urls  = $ url;
    }
    Else {}
    $ This-> debug ("Unexpected scenario: empty URL for unloaded import");
    }
    }
    }
    }
        }
        }
        }
    / / End of Patch

     
  • Jody H.

    Jody H. - 2012-12-13

    Thanks!!. This code is so usefully. I had a problem when send data from php app to java app because this bug. Now all is right. thanks again.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks