WordPress.org

Ready to get started?Download WordPress

Forums

plugin installation error (9 posts)

  1. aneuryzma
    Member
    Posted 5 years ago #

    Hi,

    I get the following error when I try to install a new theme or plugin. I've the latest wp 2.8

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /Users/aneuryzma/Sites/wordpress/wp-admin/includes/class-wp-upgrader.php on line 180

    thanks

  2. aneuryzma
    Member
    Posted 5 years ago #

    HI,

    I guess the dirlist function is not returning anything.. is maybe because file permissions problem ? I can't install any theme or plugin...

    $source_files = array_keys( $wp_filesystem->dirlist($remote_source) );

    thanks

  3. aneuryzma
    Member
    Posted 5 years ago #

    anybody can give me help ?

    I just installed wordpress 2.8.1 and I tried to install the plugins and I got the same error.

    thanks

  4. Lee Henderson
    Member
    Posted 4 years ago #

    I'm also having this problem on 2.8.4. It's running on a Mac OS X 10.4.11 Server. PHP 4.4.4. Apache/1.3.33

    Perhaps I'm running into a known problem with an older PHP/Apache?

  5. darkman82
    Member
    Posted 4 years ago #

    I lost many hours over this too and, fortunately, I found the problem.
    There's a conceptual bug. The engineer who wrote class-ftp-sockets.php
    pretends to read at most ONE line on the FTP Control Session, after each request (FTP Command), this works in most cases, but not always.
    In our case, when we do a "LIST -la" (follow dirlist function) the FTP server (Pure-FTP) answers with something like this:

    150 Accepted data connection
    226-Options: -a -l
    226 3 matches total

    Now, take a look in _readmsg function (class-ftp-sockets.php):
    $tmp=@socket_read($this->_ftp_control_sock, 4096, PHP_BINARY_READ);
    It tries to read 4K of data, no matter if one or many lines, then
    it tries to extract the FTP Server Reply Codes through regular expression:
    $go = !preg_match("/^([0-9]{3})(-.+\\1)? [^".CRLF."]+".CRLF."$/Us", $this->_message, $regs);

    BUT the previous pattern will match if and only if the string is a LINE, if not, thinking that we are in presence of a partial line, it tries to read again appending new incoming data in order to complete the LINE. Unfortunately, there is nothing to read and it fails with "Resource temporarily unavailable" message.
    _readmsg fails => _exec fails => _list fails => rawlist fails => dirlist fails => array_keys FAILS!

    _readmsg is called by _exec every time we do a FTP command:

    $status=@socket_write($this->_ftp_control_sock, $cmd.CRLF);
                    if($status===false) {
                            $this->PushError($fnction,'socket write failed', socket_strerror(socket_last_error($this->stream)));
                            return FALSE;
                    }
                    $this->_lastaction=time();
                    if(!$this->_readmsg($fnction)) return FALSE;

    Between socket_write and _readmsg we can't know how many lines the FTP Server has flushed out on the ftp control stream then, we cannot assume to read at most ONE line or partial line.

    At this point, a buffered reader seems to be necessary.

    NOTE: I have this problem only in one server, on the others all works fine.

  6. darkman82
    Member
    Posted 4 years ago #

    I solved by changing some lines of code in class-ftp-sockets.php.

    Replace original class-ftp-sockets.php with this file http://darkman.it/x/class-ftp-sockets.php.txt
    or use this patch
    http://darkman.it/x/class-ftp-sockets.patch
    and let me know if it works for you too.

  7. kirkvan
    Member
    Posted 4 years ago #

    darkman82, thanks much for taking the time to post your research. I've spent hours trying to hunt down this solution. Instead of changing the code, in cPanel/WHM I switched from Pure-FTPD to ProFTPD. Problem solved (although I'd prefer to be running Pure-FTPD). I've wanted to use WordPress' built-in updaters for many months, so thanks again.

  8. ajinkya.kulkarni
    Member
    Posted 4 years ago #

    @darkman82

    thanks for giving patch and replaced class. It really helped!

  9. darkman82
    Member
    Posted 4 years ago #

    No problem ;)
    According to WP Trac, the patch will be applied to the 3.1 realease.
    http://core.trac.wordpress.org/ticket/10831

Topic Closed

This topic has been closed to new replies.

About this Topic