Re: Req #19344 [Com]: Class presence not tested before inclusion

From: Date: Fri, 23 Mar 2012 17:15:13 +0000
Subject: Re: Req #19344 [Com]: Class presence not tested before inclusion
References: 1  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-6061@lists.php.net to get a copy of this message
On Mar 22, 2012, at 17:09, "kanea@free.fr" <pear-qa@lists.php.net> wrote: > Edit report at > https://pear.php.net/bugs/bug.php?id=19344&edit=1 > > ID: 19344 > Comment by: kanea@free.fr > Reported By: kanea at free dot fr > Summary: Class presence not tested before inclusion > Status: Feedback > Type: Feature/Change Request > Package: HTTP_Request2 > Operating System: all > Package Version: 2.0.0 > PHP Version: 5.3.5 > Roadmap Versions: > New Comment: > > After reread, this is really hard to distinguish code with my identation > and no colors. > > A simple question, is it possible to have highlighting with this > comments boxes? > > > Previous Comments: > ------------------------------------------------------------------------ > > [2012-03-22 21:06:37] kanea > > Hoping this is clearer with this. > > ------------------------------------------------------------------------ > > [2012-03-22 21:05:36] kanea > > Added #patch bug:19344;patch:Request2.php.patch;revision:1332450336;. > > ------------------------------------------------------------------------ > > [2012-03-22 18:58:03] avb > > -Status: Open > +Status: Feedback > Please provide your proposed changes as a diff against current SVN. Use > "Add patch" link to upload. > > It is extremely hard to read currently. > > ------------------------------------------------------------------------ > > [2012-03-22 18:48:25] kanea > > Description: > ------------ > For a plugin which connect wordpress to CaasuleCRM that i > realized for a client, i must integrate a default solution if PEAR > is not present. > > To make that, i remove the require_once and concanete all > class in a single file. Every works fine (capasule and other > depandency) except this line 821 wich don't test the class > existance before make the include. > > So i propose a solution in expected result > > Test script: > --------------- > Line 821 in Request2.php : > > if (!class_exists($adapter, false)) and > preg_match('/^HTTP_Request2_Adapter_([a-zA-Z0-9]+)$/', $adapter)) { > include_once str_replace('_', DIRECTORY_SEPARATOR, > $adapter) . '.php'; > } > > Expected result: > ---------------- > <?php > if (!class_exists($adapter, false)) { > if (preg_match('/^HTTP_Request2_Adapter_([a-zA-Z0- > 9]+)$/', $adapter)) { > include_once str_replace('_', > DIRECTORY_SEPARATOR, $adapter) . '.php'; > } > } > > ------------------------------------------------------------------------ > > > -- > Edit this bug report at > https://pear.php.net/bugs/bug.php?id=19344&edit=1 > > > -- > PEAR Bugs Mailing List (http://pear.php.net/bugs/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.pear.qa (#6061) next »