Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.2

Doc Bug #12486 Scope Resolution Operator (::) is not available
Submitted: 2007-11-20 13:01 UTC
From: maru Assigned:
Status: Wont fix Package: Services_TinyURL (version 0.1.1)
PHP Version: 5.2.4 OS: Linux CentOS4.4
Roadmaps: (Not assigned)    
Subscription  


 [2007-11-20 13:01 UTC] maru (Tomoyuki Maruta)
Description: ------------ I have to run the sample code and error. "create" function is "$this->api" using. Scope Resolution Operator (::) is not available Correct sample $tinyurl = new Services_TinyURL(); $url = $tinyurl->create('http://www.joestump.net'); Test script: --------------- <?php require_once 'Services/TinyURL.php'; try { $url = Services_TinyURL::create('http://www.joestump.net'); echo $url; } catch (Services_TinyURL_Exception $e) { echo $e->getMessage(); } ?> Expected result: ---------------- display http://tinyurl.com/2c3gzr Actual result: -------------- Fatal error: Using $this when not in object context in /usr/local/lib/php//Services/TinyURL.php on line 92

Comments

 [2007-12-06 06:17 UTC] jstump (Joe Stump)
The proper way is to instantiate the class: try { $tiny = new Services_TinyURL(); $url = $tiny->create('http://www.joestump.net'); echo $url . "\n"; } catch (Services_TinyURL_Exception $e) { echo $e->getMessage(); } That being said, I did fix the documentation in my comments. Sorry about that. It changed during the submission process per PEAR group comments.