WordPress.org

Ready to get started?Download WordPress

Forums

Table of content
[resolved] PHP Warning: readdir() expects parameter 1 to be resource (11 posts)

  1. markusN
    Member
    Posted 7 months ago #

    Hi,

    I tried to install some of your plugins into my Debian based WP installation, all generate (at high rate, i.e. some million entriesper second) this PHP warning:

    ...
    [Mon Dec 30 14:53:54 2013] [error] [client xx.yy.197.131] PHP Warning: readdir() expects parameter 1 to be resource, boolean given in /var/lib/wordpress/wp-content/plugins/content-table/core/translation.class.php on line 998, referer: http://zzz.org/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=
    [Mon Dec 30 14:53:54 2013] [error] [client xx.yy.197.131] PHP Warning: readdir() expects parameter 1 to be resource, boolean given in /var/lib/wordpress/wp-content/plugins/content-table/core/translation.class.php on line 998, referer: http://zzz.org/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=
    [Mon Dec 30 14:53:54 2013] [error] [client xx.yy.197.131] PHP Warning: readdir() expects parameter 1 to be resource, boolean given in /var/lib/wordpress/wp-content/plugins/content-table/core/translation.class.php on line 998, referer: http://zzz.org/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=
    [Mon Dec 30 14:53:54 2013] [error] [client xx.yy.197.131] PHP Warning: readdir() expects parameter 1 to be resource, boolean given in /var/lib/wordpress/wp-content/plugins/content-table/core/translation.class.php on line 998, referer: http://zzz.org/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=
    ...

    I don't know how to fix that. Tried with your "image zoom" and "table of contents". If it helps, I'm happy to make tests.

    thanks

    http://wordpress.org/plugins/content-table/

  2. Sed Lex
    Member
    Plugin Author

    Posted 7 months ago #

    Ok I may understand your issue but it is still strange ... Obviously, the plugin is not able to list the files in the /lang/ directory of the plugin...

    Are you able to modify the rights on that folder to allow such listing ?

  3. Sed Lex
    Member
    Plugin Author

    Posted 7 months ago #

    Normally, the mentioned line (ie. 998) should only be called when a admin or a logged user access an admin page ...
    You are really talking about millions entries ?

  4. markusN
    Member
    Posted 7 months ago #

    Thanks for your immediate response!

    Yes, 3.3 million lines in the apache error.log generated in no time... (I used grep/wc -l to count).

    I installed the plugin through the WP interface, so I would expect that the file rights are correct. I am root on the system, so I could check/modify knowing a bit better, what to try.

  5. Sed Lex
    Member
    Plugin Author

    Posted 7 months ago #

    Could you give me the rights on the lang folder and what user is used to execute the php script (apache, etc.) ?
    The user should have the right to read, write and execute on that folder to avoid any problem

    I may have an idea regarding the number of entries ... Is xx.yy.197.131 your IP address ?

    I have a backup solution if you are not able to set the right correctly

  6. markusN
    Member
    Posted 7 months ago #

    Concering the permission:

    ps -aef | grep apache
    root 11472 1 0 15:28 ? 00:00:00 /usr/sbin/apache2 -k start
    root 19676 11472 0 16:29 ? 00:00:00 /usr/sbin/apache2 -k start

    Why are write permissions needed on the lang/ folder?

    root@markus /var/lib/wordpress/wp-content/plugins/content-table # l lang/
    total 100K
    -rw-r--r-- 1 www-data www-data 3.4K Dec 30 14:53 tableofcontent-de_DE.mo
    -rw-r--r-- 1 www-data www-data 4.1K Dec 30 14:53 tableofcontent-de_DE.po
    -rw-r--r-- 1 www-data www-data 2.9K Dec 30 14:53 tableofcontent-es_ES.mo
    -rw-r--r-- 1 www-data www-data 4.2K Dec 30 14:53 tableofcontent-es_ES.po
    -rw-r--r-- 1 www-data www-data 2.8K Dec 30 14:53 tableofcontent-es_MX.mo
    -rw-r--r-- 1 www-data www-data 4.1K Dec 30 14:53 tableofcontent-es_MX.po
    -rw-r--r-- 1 www-data www-data 2.6K Dec 30 14:53 tableofcontent-fi_FI.mo
    -rw-r--r-- 1 www-data www-data 3.9K Dec 30 14:53 tableofcontent-fi_FI.po
    -rw-r--r-- 1 www-data www-data 3.2K Dec 30 14:53 tableofcontent-fr_FR.mo
    -rw-r--r-- 1 www-data www-data 3.8K Dec 30 14:53 tableofcontent-fr_FR.po
    -rw-r--r-- 1 www-data www-data 3.8K Dec 30 14:53 tableofcontent-it_IT.mo
    -rw-r--r-- 1 www-data www-data 4.6K Dec 30 14:53 tableofcontent-it_IT.po
    -rw-r--r-- 1 www-data www-data 2.9K Dec 30 14:53 tableofcontent-nl_NL.mo
    -rw-r--r-- 1 www-data www-data 3.5K Dec 30 14:53 tableofcontent-nl_NL.po
    -rw-r--r-- 1 www-data www-data 4.1K Dec 30 14:53 tableofcontent.pot
    -rw-r--r-- 1 www-data www-data 1.1K Dec 30 14:53 tableofcontent-ro_RO.mo
    -rw-r--r-- 1 www-data www-data 1.8K Dec 30 14:53 tableofcontent-ro_RO.po
    -rw-r--r-- 1 www-data www-data 3.4K Dec 30 14:53 tableofcontent-ru_RU.mo
    -rw-r--r-- 1 www-data www-data 4.8K Dec 30 14:53 tableofcontent-ru_RU.po

    Concerning the "error.log" entries:
    - I install the plugin via WP, then activate,
    - when going in "SL Plugins", "Table of contents" the warning "pumping" starts:

    head error.log
    [Mon Dec 30 15:28:30 2013] [notice] Apache/2.2.22 (Debian) DAV/2 SVN/1.6.17 PHP/5.4.4-14+deb7u7 mod_ssl/2.2.22 OpenSSL/1.0.1e configured -- resuming normal operations
    [Mon Dec 30 17:36:58 2013] [error] [client xxx.62.11.251] PHP Warning: readdir() expects parameter 1 to be resource, boolean given in /var/lib/wordpress/wp-content/plugins/content-table/core/translation.class.php on line 998, referer: http://courses.neteler.org/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=
    [Mon Dec 30 17:36:58 2013] [error] [client xxx.62.11.251] PHP Warning: readdir() expects parameter 1 to be resource, boolean given in /var/lib/wordpress/wp-content/plugins/content-table/core/translation.class.php on line 998, referer: http://courses.neteler.org/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=

    [... cut ...]

    [Mon Dec 30 17:37:35 2013] [error] [client xxx.62.11.251] PHP Warning: readdir() expects parameter 1 to be resource, boolean given in /var/lib/wordpress/wp-content/plugins/content-table/core/translation.class.php on line 998, referer: http://courses.neteler.org/wp-admin/plugins.php?activate=true&plugin_status=all&paged=1&s=

    --> in less than 1 minute I get almost 3 million errors:
    grep 'PHP Warning: readdir() expects parameter 1' error.log | wc -l
    2873977

    ... my server seems to be fairly fast :-) So, a loop somewhere?

    The IP address is dynamic and the one from where I access right now.

  7. Sed Lex
    Member
    Plugin Author

    Posted 7 months ago #

    It is not a loop but a "while" that normally does end ... but not in this case : if the folder lang is not readable, the following line seems to be always true ...

    $dir = @opendir($path."/lang/");
    while(false !== ($item = readdir($dir))) {
       ...
    }

    I will correct it in a next version... In the meanwhile, you have to set to the lang folder a x (execute rights) for the www-data users

    The write in only optional if you decide to modify the translations

  8. markusN
    Member
    Posted 7 months ago #

    The current (yet unmodified) permissions are:

    drwxr-xr-x 2 www-data www-data 4.0K Dec 30 17:36 lang

    .. this does not suffice? (thanks again for your support)

  9. Sed Lex
    Member
    Plugin Author

    Posted 7 months ago #

    I believe so ... But you have to told me !
    I will release a new version correcting this issue

  10. markusN
    Member
    Posted 7 months ago #

    Thanks a lot, looking forward to test it!

  11. Sed Lex
    Member
    Plugin Author

    Posted 5 months ago #

    That will be corrected in the next version... which be release in minutes

Reply

You must log in to post.

About this Plugin

About this Topic