Bug #22952 [Com]: Net_Whois: Call to a member function on a non-object in

From: Date: Sun, 01 Aug 2010 13:43:53 +0000
Subject: Bug #22952 [Com]: Net_Whois: Call to a member function on a non-object in
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153012@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=22952&edit=1 ID: 22952 Comment by: ajaygolani at gmail dot com Reported by: x4com at web dot de Summary: Net_Whois: Call to a member function on a non-object in Status: Bogus Type: Bug Package: PEAR related Operating System: Debian Linux/GNU 3.0r1 PHP Version: 4.3.0 Block user comment: N New Comment: <?php require_once "../Net/Whois.php"; $query = "softgrid.in"; // get information about $whois = new Net_Whois; $data = $whois->query($query); echo $data; ?> The code runs fine, but not formatted. Anyone got the well arranged solution?? Previous Comments: ------------------------------------------------------------------------ [2003-06-26 03:56:07] arnaud@php.net Please be careful about the code you write, you forgot a $ $whois = new Net_Whois; $data = $whois->query("poorman.org"); ^ echo $data; ------------------------------------------------------------------------ [2003-06-26 03:44:44] ad1 at poorman dot org Example Have problem :< $whois = new Net_Whois; $data = whois->query("poorman.org"); echo $data; ------------------------------------------------------------------------ [2003-05-29 05:42:46] ad1 at poorman dot org when I modify to this, $whoisData = NULL->_connect($whoisServer, $domain); it's still have problem like this, Parse error: parse error, unexpected T_OBJECT_OPERATOR in /home/local/lib/php/Net/Whois.php on line 131 Fatal error: Undefined class name 'net_whois' in /home/richliu/public_html/test/whoistest.php on line 12 ------------------------------------------------------------------------ [2003-03-29 20:13:15] pollita@php.net The Net_Whois query method uses $this to refer to the instantiated object. Since you're attempting to call the method statically there is no instantiation to reference and hence the parses sees: $whoisData = NULL->_connect($whoisServer, $domain); which obviously makes no sense. Instantiate the class, then call the method via your newly created object. ------------------------------------------------------------------------ [2003-03-29 09:48:19] x4com at web dot de Hello, I get this error with Net_Whois 1.0.1: Fatal error: Call to a member function on a non-object in [..]/Whois.php on line 131 My Script is this: <?php require_once "./Whois.php"; $server = "whois.denic.de"; $query = "phpcrawler.de"; $data = Net_Whois::query($server,$query); echo $data; ?> My PHP Version is 4.2.2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=22952&edit=1

« previous php.bugs (#153012) next »