logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Mail wg. nusoap: msg#00107

Subject: Re: Mail wg. nusoap
Hi !

Thank you!

We use PHP 4.3.10 ...

Ingo Fischer

Scott Nichol wrote:
Thanks. This is *much* better than what I did and I will apply it immediately.

What version of PHP gives you the warnings? I was not seeing warnings with any of the versions I use.

Scott Nichol
----- Original Message ----- From: "Ingo Fischer" <ingo.fischer@xxxxxxxx>
To: <nusoap-general@xxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, April 17, 2007 10:48 AM
Subject: [Nusoap-general] Mail wg. nusoap


Hallo,

when using the nusoap version 1.66 we've got the following error when
using error-reporting=E_ALL:

Script-Error 8 happend: Error 8 occured in File
class.soap_transport_http.php on Line 248

Error-Message : Use of undefined constant CURLOPT_CONNECTIONTIMEOUT -
assumed 'CURLOPT_CONNECTIONTIMEOUT'


The code at that line checks for existing defines for curl like this:

                // Avoid warnings when PHP does not have these options

                @$CURLOPT_CONNECTIONTIMEOUT =
CURLOPT_CONNECTIONTIMEOUT;
                if ($CURLOPT_CONNECTIONTIMEOUT ==
'CURLOPT_CONNECTIONTIMEOUT')
                        $CURLOPT_CONNECTIONTIMEOUT = 78;

                @$CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH;

                if ($CURLOPT_HTTPAUTH == 'CURLOPT_HTTPAUTH')

                        $CURLOPT_HTTPAUTH = 107;

                @$CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH;

                if ($CURLOPT_PROXYAUTH == 'CURLOPT_PROXYAUTH')

                        $CURLOPT_PROXYAUTH = 111;

                @$CURLAUTH_BASIC = CURLAUTH_BASIC;

                if ($CURLAUTH_BASIC == 'CURLAUTH_BASIC')

                        $CURLAUTH_BASIC = 1;

                @$CURLAUTH_DIGEST = CURLAUTH_DIGEST;

                if ($CURLAUTH_DIGEST == 'CURLAUTH_DIGEST')

                        $CURLAUTH_DIGEST = 2;

                @$CURLAUTH_NTLM = CURLAUTH_NTLM;

                if ($CURLAUTH_NTLM == 'CURLAUTH_NTLM')

                        $CURLAUTH_NTLM = 8;


If a define (like CURLOPT_CONNECTIONTIMEOUT) is not defined, the php
returns a waring using the error level E_ALL.

To check if a constant exists php has got a function defined(). I
I replaced the code quoted above on our system with the following:

                // Avoid warnings when PHP does not have these options

                if (defined('CURLOPT_CONNECTIONTIMEOUT'))

                  $CURLOPT_CONNECTIONTIMEOUT =
CURLOPT_CONNECTIONTIMEOUT;
                else

                  $CURLOPT_CONNECTIONTIMEOUT = 78;

                if (defined('CURLOPT_HTTPAUTH'))

                  $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH;

                else

                  $CURLOPT_HTTPAUTH = 107;

                if (defined('CURLOPT_PROXYAUTH'))

                  $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH;

                else

                  $CURLOPT_PROXYAUTH = 111;

                if (defined('CURLAUTH_BASIC'))

                  $CURLAUTH_BASIC = CURLAUTH_BASIC;

                else

                  $CURLAUTH_BASIC = 1;

                if (defined('CURLAUTH_DIGEST'))

                  $CURLAUTH_DIGEST = CURLAUTH_DIGEST;

                else

                  $CURLAUTH_DIGEST = 2;

                if (defined('CURLAUTH_NTLM'))

                  $CURLAUTH_NTLM = CURLAUTH_NTLM;

                else

                  $CURLAUTH_NTLM = 8;


Here the defined constand is used only if it really exists. Otherwhise
the else branch is used and the variable is set to a predefined value.

This works perfect for us (no warnings anymore) where these defines do
not exist but should also work for someone that has got curl support in
PHP with existing defines.

Attached is a diff of the two versions. Please check and add to your CVS.

Greetings

Ingo Fischer

--
Ingo Fischer                           Tel: +49 (0)721-91374-4546
1&1 Internet AG
Karlsruhe



--------------------------------------------------------------------------------


Index: classes/nusoap/class.soap_transport_http.php
===================================================================
RCS file: /home/cvs/repositories/ipayment/ipayment/classes/nusoap/class.soap_transport_http.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- classes/nusoap/class.soap_transport_http.php 16 Apr 2007 09:23:37 -0000 1.3 +++ classes/nusoap/class.soap_transport_http.php 17 Apr 2007 12:10:00 -0000 1.4
@@ -8,7 +8,7 @@
* NOTE: PHP must be compiled with the CURL extension for HTTPS support
*
* @author   Dietrich Ayala <dietrich@xxxxxxxxx>
-* @version $Id: class.soap_transport_http.php,v 1.3 2007/04/16 09:23:37 ingo Exp $ +* @version $Id: class.soap_transport_http.php,v 1.4 2007/04/17 12:10:00 stephan Exp $
* @access public
*/
class soap_transport_http extends nusoap_base {
@@ -245,24 +245,30 @@
 return false;
 }
 // Avoid warnings when PHP does not have these options
- @$CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT;
- if ($CURLOPT_CONNECTIONTIMEOUT == 'CURLOPT_CONNECTIONTIMEOUT')
- $CURLOPT_CONNECTIONTIMEOUT = 78;
- @$CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH;
- if ($CURLOPT_HTTPAUTH == 'CURLOPT_HTTPAUTH')
- $CURLOPT_HTTPAUTH = 107;
- @$CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH;
- if ($CURLOPT_PROXYAUTH == 'CURLOPT_PROXYAUTH')
- $CURLOPT_PROXYAUTH = 111;
- @$CURLAUTH_BASIC = CURLAUTH_BASIC;
- if ($CURLAUTH_BASIC == 'CURLAUTH_BASIC')
- $CURLAUTH_BASIC = 1;
- @$CURLAUTH_DIGEST = CURLAUTH_DIGEST;
- if ($CURLAUTH_DIGEST == 'CURLAUTH_DIGEST')
- $CURLAUTH_DIGEST = 2;
- @$CURLAUTH_NTLM = CURLAUTH_NTLM;
- if ($CURLAUTH_NTLM == 'CURLAUTH_NTLM')
- $CURLAUTH_NTLM = 8;
+                if (defined('CURLOPT_CONNECTIONTIMEOUT'))
+ $CURLOPT_CONNECTIONTIMEOUT = CURLOPT_CONNECTIONTIMEOUT;
+                else
+                  $CURLOPT_CONNECTIONTIMEOUT = 78;
+                if (defined('CURLOPT_HTTPAUTH'))
+                  $CURLOPT_HTTPAUTH = CURLOPT_HTTPAUTH;
+                else
+                  $CURLOPT_HTTPAUTH = 107;
+                if (defined('CURLOPT_PROXYAUTH'))
+                  $CURLOPT_PROXYAUTH = CURLOPT_PROXYAUTH;
+                else
+                  $CURLOPT_PROXYAUTH = 111;
+                if (defined('CURLAUTH_BASIC'))
+                  $CURLAUTH_BASIC = CURLAUTH_BASIC;
+                else
+                  $CURLAUTH_BASIC = 1;
+                if (defined('CURLAUTH_DIGEST'))
+                  $CURLAUTH_DIGEST = CURLAUTH_DIGEST;
+                else
+                  $CURLAUTH_DIGEST = 2;
+                if (defined('CURLAUTH_NTLM'))
+                  $CURLAUTH_NTLM = CURLAUTH_NTLM;
+                else
+                  $CURLAUTH_NTLM = 8;

 $this->debug('connect using cURL');
 // init CURL




--------------------------------------------------------------------------------


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/


--------------------------------------------------------------------------------


_______________________________________________
Nusoap-general mailing list
Nusoap-general@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/nusoap-general






--
Ingo Fischer
_____________________________________________________________________

Ingo Fischer
1&1 Internet AG
Karlsruhe
Tel.: 0721/91374-0             Secure Internet-Payment:
http://www.1und1.de                           https://ipayment.de
_____________________________________________________________________

1&1 Internet AG
Brauerstraße 48
76135 Karlsruhe

Amtsgericht Montabaur HRB 6484

Vorstand: Henning Ahlert, Hans-Henning Doerr, Ralph Dommermuth,
          Matthias Ehrlich, Andreas Gauger, Matthias Greve,
          Robert Hoffmann, Achim Weiss
Aufsichtsratsvorsitzender: Michael Scheeren

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Nusoap-general mailing list
Nusoap-general@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/nusoap-general

Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>