Re: [PEAR-BUGS] [PEAR-BUG] Req #19344 [Com]: Class presence not tested before inclusion

[email protected] ("[email protected]") Fri, 23 Mar 2012 12:39:53 -0400
Newsgroups php.pear.qa
Message-ID <[email protected]>

On Mar 22, 2012, at 17:06, "[email protected]" <[email protected]> wrote:

> Edit report at https://pear.php.net/bugs/bug.php?id=19344&edit=1
> 
> ID:               19344
> Comment by:       [email protected]
> 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:
> 
> Hoping this is clearer with this.
> 
> 
> Previous Comments:
> ------------------------------------------------------------------------
> 
> [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
>