Req #19344 [Com]: Class presence not tested before inclusion
| From: | kanea@free.fr | Date: | Thu, 22 Mar 2012 21:09:16 +0000 |
| Subject: | Req #19344 [Com]: Class presence not tested before inclusion | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-8425@lists.php.net to get a copy of this message | ||
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