Bug #19298 [Com]: fatal error when calling getCode() for exception

From: Date: Sat, 18 Feb 2012 15:14:17 +0000
Subject: Bug #19298 [Com]: fatal error when calling getCode() for exception
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-8291@lists.php.net to get a copy of this message
Edit report at https://pear.php.net/bugs/bug.php?id=19298&edit=1 ID: 19298 Comment by: faca@novisad.net Reported By: faca at novisad dot net Summary: fatal error when calling getCode() for exception Status: Bogus Type: Bug Package: HTTP_Request2 Operating System: Ubuntu 10.04.3, Windows XP SP3 Package Version: 2.0.0 PHP Version: 5.3.5 Roadmap Versions: New Comment: Thank you for your kindness sir. Calling other people idiots tell more about you then about me. Yes, it is my stupid mistake and I am apologizing because I submitted such bug. Previous Comments: ------------------------------------------------------------------------ [2012-02-18 15:00:43] avb -Status: Open +Status: Bogus This is a bug tracker, not "PHP for idiots" support forum. $exception.getCode() is a bit different from $exception->getCode() ------------------------------------------------------------------------ [2012-02-18 14:50:51] faca Description: ------------ Randomly I am getting "Call to undefined function getCode()" when I try to call getCode() function of HTTP_Request2_MessageException object. If I examine exception in that case it is visible from description that is one of known types (e.g. MALFORMED_RESPONSE or TIMEOUT). Test script: --------------- function checkUrlForced($url) { $request = new HTTP_Request2($url); $request->setConfig("follow_redirects", true); $request->setConfig("store_body", false); $request->setHeader("User-Agent", $_SERVER['HTTP_USER_AGENT']); try { return Status::getHttpStatus($request->send()->getStatus()); } catch (HTTP_Request2_LogicException $exception) { return Status::HTTP_INVALID_REQUEST(); } catch (HTTP_Request2_ConnectionException $exception) { return Status::HTTP_NO_CONNECTION(); } catch (HTTP_Request2_MessageException $exception) { return $exception.getCode() } } ------------------------------------------------------------------------ -- Edit this bug report at https://pear.php.net/bugs/bug.php?id=19298&edit=1

« previous php.pear.bugs (#8291) next »