PHP Classes

nasty error

Recommend this page to a friend!

      Gravatar RPC  >  All threads  >  nasty error  >  (Un) Subscribe thread alerts  
Subject:nasty error
Summary:got an error im any attempt to use this
Messages:5
Author:max costa
Date:2009-10-09 00:44:37
Update:2009-11-07 12:28:20
 

  1. nasty error   Reply   Report abuse  
Picture of max costa max costa - 2009-10-09 00:44:37
First, cool you wroted this! The documentation at gravatar.com it's horrible and thanks this I can finally test some of their API.
I admit haved to slight modify this class to avoid several error like:
parse error, expecting `')'' in C:\GravatarRPC.class.php on line 76

easily fixed the errors, I've tried to check initialization:
$b = new GravatarRPC("xxxxxxxx","someone@somebody.com");

No errors, or at list not visible ones...
Ok, try to activate test like this:
$b->test();

Fatal error: Call to a member function faultCode() on a non-object in C:\apachefriends\xampp\htdocs\mfusionn\core\inc\GravatarRPC.class.php on line 47

line 47 is this:
if (!$response->faultCode()) {

Any function give back this error... Any suggestion?

  2. Re: nasty error   Reply   Report abuse  
Picture of Wouter van Vliet Wouter van Vliet - 2009-11-02 00:30:31 - In reply to message 1 from max costa
Dear Marco,

I've re-tested my code, and I don't get any parse errors nor messages about calling faultcode on a non-object.

Could you send me your version of the classfile so I can take a look at your modifications?

Please also verify that you're using PHP version 5.3.

Regards,
Wouter

  3. Re: nasty error   Reply   Report abuse  
Picture of max costa max costa - 2009-11-02 17:07:05 - In reply to message 2 from Wouter van Vliet
Thanks for response! I'm sorry for my delay but I was away with no internet connection.
I just downloaded last version you posted and got this error again:
on Wintel:
Parse error: parse error, expecting `')'' in C:\etc\GravatarRPC.class.php on line 76
on Linux:
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /home/etc/inc/GravatarRPC.class.php on line 76

My php version is 5.2.11 that is the last one (http://php.net/ChangeLog-5.php)

  4. Re: nasty error   Reply   Report abuse  
Picture of max costa max costa - 2009-11-02 17:11:04 - In reply to message 3 from max costa
OOppps,
Just realized that PHP 5.3 has been released. I'm checking the changes to figure out why the error.

  5. Re: nasty error   Reply   Report abuse  
Picture of Wouter van Vliet Wouter van Vliet - 2009-11-07 12:28:21 - In reply to message 4 from max costa
Hi Max,

The main difference between 5.2 and 5.3 is that 5.3 added support for "late static binding", namespaces and - which is the thing you get the parse error on - closures. I could easily change the code to support 5.2, but since I really like the 5.3 release I want the world to upgrade asap ;-).

Closure work like this:

<code>
$myInt = 44;
$myArray = Array(1, 2, 3, 4, 5);
$myNewArray = array_map(function($num) use ($myInt) {
return $num * $myInt;
}, $myArray);
</code>

A construction previously only possible by either creating a whole class, just for such a call - or using create_function and the confusing third argument to array_map.

So - yes, it's worth upgrading.

Regards,
Wouter