Mantis - Quercus
Viewing Issue Advanced Details
4728 major always 08-25-11 01:23 06-21-12 00:55
timowest  
nam  
normal  
closed 4.0.14  
fixed  
none    
none  
0004728: Cannot install theme in Wordpress using Quercus
I cannot install themes in Wordpress 3.2.1 when using Quercus 4.0.18.

I get the following error :

Installing Theme: Zombie Apocalypse 1.34

Downloading install package from http://wordpress.org/extend/themes/download/zombie-apocalypse.1.34.zip? [^]

Unpacking the package?

Incompatible Archive. PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

Notes
(0005462)
timowest   
08-25-11 02:07   
I am using Jetty
(0005464)
timowest   
08-25-11 05:20   
I added some logging to the pclzip class and it appears that the .tmp files it processes are empty. Jetty is the owner of the used directory.
(0005468)
timowest   
08-26-11 00:34   
I was able to fix the issue locally by changing the following line in class-http.php / _get_first_available_transport :

$request_order = array( 'curl', 'streams', 'fsockopen' );

to

$request_order = array( 'fsockopen', 'curl', 'streams' );

curl didn't work and streams threw an exception. fsockopen worked.
(0005470)
kdecherf   
08-27-11 08:19   
Hi,

Can you give us the exception thrown by streams please ? Thanks.
(0005471)
timowest   
08-28-11 23:50   
When using streams I get the following error logs when trying to install a theme :

Aug 29, 2011 9:45:58 AM com.caucho.quercus.env.Env error
INFO: /var/lib/jetty/webapps/wordpress/wp-includes/class-http.php:906: Warning: java.io.IOException: Content-Length=97 but only received 0 [stream_get_contents]
Aug 29, 2011 9:46:05 AM com.caucho.quercus.env.Env error
INFO: /var/lib/jetty/webapps/wordpress/wp-includes/class-http.php:906: Warning: java.io.IOException: Content-Length=97 but only received 0 [stream_get_contents]
Aug 29, 2011 9:46:07 AM com.caucho.quercus.env.Env error
INFO: /var/lib/jetty/webapps/wordpress/wp-includes/class-http.php:906: Warning: java.io.IOException: Content-Length=153 but only received 0 [stream_get_contents]
(0005472)
timowest   
08-29-11 01:03   
I found now also the bug in the curl module. When using the options CURLOPT_RETURNTRANSFER and CURLOPT_FILE, the CurlResource class skips outputting to outputFile and returns the contents directly.

When CURLOPT_FILE is given, the output file serialization needs to be done. CURLOPT_RETURNTRANSFER needs to be handled later.

The problematic code is here :

    if (_isReturningData)
      return data;

    if (_outputHeaderFile != null) {
      FileModule.fwrite(env,
                        _outputHeaderFile,
                        _header.toInputStream(),
                        Integer.MAX_VALUE);
    }

    if (_outputFile != null) {
      FileModule.fwrite(env,
                        _outputFile,
                        data.toInputStream(),
                        Integer.MAX_VALUE);

    }
    else {
      env.print(data);
    }

Buffering to a bytearrayoutputstream or something like that might a solution here.
(0005474)
timowest   
08-29-11 01:38   
The streams bug appears in com.caucho.vfs.HttpStream getConnInputImpl() :

        // server/1963
        if (len != writeLength) {
          throw new IOException(L.l("Content-Length={0} but only received {1}",
                                    len, "" + writeLength));
        }

The usage of the variable _tempStream seems to be broken.
(0005909)
nam   
06-21-12 00:55   
Fixed for 4.0.29.

php/1v0z