Bug #19298 [Opn->Bgs]: fatal error when calling getCode() for exception

From: Date: Sat, 18 Feb 2012 15:00:44 +0000
Subject: Bug #19298 [Opn->Bgs]: fatal error when calling getCode() for exception
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-8290@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 Updated by: borz_off@cs.msu.su Reported By: faca at novisad dot net Summary: fatal error when calling getCode() for exception -Status: Open +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: -Status: Open +Status: Bogus This is a bug tracker, not "PHP for idiots" support forum. $exception.getCode() is a bit different from $exception->getCode() Previous Comments: ------------------------------------------------------------------------ [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 (#8290) next »