Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.2

Bug #19891 undefined function init()
Submitted: 2013-04-09 18:23 UTC
From: mak Assigned: bigmichi1
Status: Closed Package: Text_CAPTCHA (version 0.4.6)
PHP Version: 5.3.9 OS: window 7
Roadmaps: (Not assigned)    
Subscription  


 [2013-04-09 18:23 UTC] mak (mak ashtekar)
Description: ------------ Having Error Undefined method init() .... Test script: --------------- require_once 'Text/CAPTCHA.php'; $imageOptions = array( 'font_size' => 24, 'font_path' => './', 'font_file' => 'ARLRDBD.TTF', 'text_color' => '#DDFF99', 'lines_color' => '#CCEEDD', 'background_color' => '#555555' ); $options = array( 'width' => 200, 'height' => 80, 'output' => 'png', 'imageOptions' => $imageOptions ); $c = Text_CAPTCHA::factory('Image'); $retval = $c->init($options); var_dump($retval); die; if (PEAR::isError($retval)) { printf('Error initializing CAPTCHA: %s!', $retval->getMessage()); exit; } Expected result: ---------------- Must call init function correctly .. $c initialize perfect with : object(PEAR_Error)[1] public 'error_message_prefix' => string '' (length=0) public 'mode' => int 1 public 'level' => int 1024 public 'code' => int 100 public 'message' => string 'Could not load driver class file Image' (length=38) public 'userinfo' => null public 'backtrace' => array 0 => array 'file' => string 'C:\wamp\bin\php\php5.3.9\pear\PEAR.php' (length=38) 'line' => int 533 'function' => string 'PEAR_Error' (length=10) 'class' => string 'PEAR_Error' (length=10) 'type' => string '->' (length=2) 'args' => array ... 1 => array 'file' => string 'C:\wamp\bin\php\php5.3.9\pear\Text\CAPTCHA.php' (length=46) 'line' => int 168 'function' => string 'raiseError' (length=10) 'class' => string 'PEAR' (length=4) 'type' => string '::' (length=2) 'args' => array ... 2 => array 'file' => string 'C:\wamp\www\mak\test\captcha\index.php' (length=38) 'line' => int 20 'function' => string 'factory' (length=7) 'class' => string 'Text_CAPTCHA' (length=12) 'type' => string '::' (length=2) 'args' => array ... public 'callback' => null Actual result: -------------- Giving Fatal Error ... Indefined function init() ...

Comments

 [2013-04-09 18:47 UTC] mak (mak ashtekar)
-Summary: problem +Summary: undefined function init()
 [2013-05-02 21:19 UTC] slughead (Klaus Ahrenst)
The function &factory($driver) in CAPTCHA.php is very broken. I get 2 errors here: 1) A file_exists check is done here, not taking the current include path into account. A better solution would be just to include the file and check the return value, since including WILL take the include path into account. 2) A test for class_exists is done, searching for $classname, however $classname is not set until after the check, hence an error. Move the declaration statement up a little and it just might work. please fix? :)
 [2013-08-05 14:02 UTC] bigmichi1 (Michael Cramer)
-Status: Open +Status: Closed -Assigned To: +Assigned To: bigmichi1
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.