FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19891&edit=1

  ID: 19891
  Updated by: michael@bigmichi1.de
  Reported By: ashtekarmukesh@gmail.com
  Summary: undefined function init()
-Status: Open
+Status: Closed
  Type: Bug
  Package: Text_CAPTCHA
  Operating System: window 7
  Package Version: 0.4.6
  PHP Version: 5.3.9
-Assigned To:
+Assigned To: bigmichi1
  Roadmap Versions:
  New Comment:

-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.




Previous Comments:
------------------------------------------------------------------------

[2013-05-02 17:19:28] slughead

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-04-09 14:47:14] mak

-Summary: problem
+Summary: undefined function init()


------------------------------------------------------------------------

[2013-04-09 14:23:17] mak

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() ...

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedAug 5, '13 at 7:57a
activeAug 5, '13 at 7:57a
posts1
users1
websitepear.php.net

1 user in discussion

Michael: 1 post

People

Translate

site design / logo © 2022 Grokbase