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

ID: 14453
Updated by: till@php.net
Reported By: php at sagi dot org
Summary: Text_Wiki outputs warnings when autoload is enabled
Status: Verified
Type: Bug
Package: Text_Wiki
Package Version: 1.2.0
PHP Version: 5.2.2
-Assigned To:
+Assigned To: till
Roadmap Versions:
New Comment:

-Assigned To:
+Assigned To: till
@Christian:

I'll attempt fixing it, can you explain where this is is the case?

To me it looks like the class names have been fixed already. I don't see
the same class names from different renders
(or maybe didn't look hard enough).

Since autoload is more or less a PHP5 feature, is it save to add an if
with version compare?

Till


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

[2008-10-26 01:58:09] cweiske

The problem here is that every renderer/type (Dokuwiki, bbcode, ...)
defines the same class names.
This makes it easy to use them once they are loaded, but has two
drawbacks:
a) Autoloaders cannot load the files because they do not follow the PEAR
directory structure
b) One cannot parse/render multiple formats in one go, because the
classes already exist.

So the proper way would be to give the classes the correct name and
modify the functions loading/using them to respect their prefix.

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

[2008-08-07 10:13:10] berdir

PHP generates such warnings, but only for internal functions:

Simple example:
Warning: class_exists() expects at most 2 parameters, 3 given in Command
line code on line 1

So, this is unfortunatly not possible..

As a short fix, I'd suggest to ignore text_wiki class in your autoload
function.

The only way to really fix this is probably by adding dummy files to
text_wiki, which "forward" the include call, as renaming the files would
break backward compability...

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

[2008-08-04 14:56:38] sagi

I tried to add autoloader support for PEAR classes, but it doesn't
really solve the problem because Text_Wiki tries to load some files
which don't match the standard PEAR directory structure.

For example, it needs to load Text_Wiki_Parse_Prefilter, but this class
resides in Text/Wiki/Parse/Default/Prefilter.php, so the autoloader
can't find it.

BTW, AFAIK PHP does not generate warnings when passing too many
parameters to a function.

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

[2008-08-04 10:58:42] justinpatrin

Except that the second parameter is specific to PHP5 and this package
still supports PHP4, so it can't be added without causing another kind
of warning.

I suggest you add support to your autoload function for loading PEAR
classes.

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

[2008-08-04 08:26:37] sagi

Description:
------------
Text_Wiki uses class_exists to check whether it needs to include a class
file.

However, such usage makes PHP dispatch an autoload call for the class,
which may generate a warning if the autoload is not looking inside the
PEAR path.

This can be fixed by passing 'false' as a second parameter for
class_exists, which will prevent the autoload call, eg.
class_exists($class, false).

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

Search Discussions

  • Till at Mar 19, 2011 at 10:23 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=14453&edit=1

    ID: 14453
    Updated by: till@php.net
    Reported By: php at sagi dot org
    Summary: Text_Wiki outputs warnings when autoload is enabled
    Status: Verified
    Type: Bug
    -Package: Text_Wiki
    +Package: Text_Wiki2
    Package Version: 1.2.0
    PHP Version: 5.2.2
    Assigned To: till
    Roadmap Versions:
    New Comment:

    -Package: Text_Wiki
    +Package: Text_Wiki2
    Nevermind, found plenty.

    Moving this to Text_Wiki2. It's unfixable on Text_Wiki.


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

    [2011-03-19 20:32:57] till

    -Assigned To:
    +Assigned To: till
    @Christian:

    I'll attempt fixing it, can you explain where this is is the case?

    To me it looks like the class names have been fixed already. I don't see
    the same class names from different renders
    (or maybe didn't look hard enough).

    Since autoload is more or less a PHP5 feature, is it save to add an if
    with version compare?

    Till

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

    [2008-10-26 01:58:09] cweiske

    The problem here is that every renderer/type (Dokuwiki, bbcode, ...)
    defines the same class names.
    This makes it easy to use them once they are loaded, but has two
    drawbacks:
    a) Autoloaders cannot load the files because they do not follow the PEAR
    directory structure
    b) One cannot parse/render multiple formats in one go, because the
    classes already exist.

    So the proper way would be to give the classes the correct name and
    modify the functions loading/using them to respect their prefix.

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

    [2008-08-07 10:13:10] berdir

    PHP generates such warnings, but only for internal functions:

    Simple example:
    Warning: class_exists() expects at most 2 parameters, 3 given in Command
    line code on line 1

    So, this is unfortunatly not possible..

    As a short fix, I'd suggest to ignore text_wiki class in your autoload
    function.

    The only way to really fix this is probably by adding dummy files to
    text_wiki, which "forward" the include call, as renaming the files would
    break backward compability...

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

    [2008-08-04 14:56:38] sagi

    I tried to add autoloader support for PEAR classes, but it doesn't
    really solve the problem because Text_Wiki tries to load some files
    which don't match the standard PEAR directory structure.

    For example, it needs to load Text_Wiki_Parse_Prefilter, but this class
    resides in Text/Wiki/Parse/Default/Prefilter.php, so the autoloader
    can't find it.

    BTW, AFAIK PHP does not generate warnings when passing too many
    parameters to a function.

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

    [2008-08-04 10:58:42] justinpatrin

    Except that the second parameter is specific to PHP5 and this package
    still supports PHP4, so it can't be added without causing another kind
    of warning.

    I suggest you add support to your autoload function for loading PEAR
    classes.

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

    The remainder of the comments for this report are too long. To view
    the rest of the comments, please view the bug report online at
    http://pear.php.net/bugs/bug.php?id=14453

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedMar 19, '11 at 7:30p
activeMar 19, '11 at 10:23p
posts2
users1
websitepear.php.net

1 user in discussion

Till: 2 posts

People

Translate

site design / logo © 2022 Grokbase