Success

User tests: Successful: Unsuccessful:

avatar elkuku
elkuku
20 Feb 2014

Currently the "Install from URL" and "Install from WEB" tasks fail in some special cases.

Test:

Try the "Install from URL" task with the following URL:
https://github.com/jtester/TestExtension/archive/1.0.zip

Expected: Installation successful
Actual: Unable to find install package

Test2:

Download the package first and install via "Upload"

Expected: Installation successful
Actual: Installation successful

Apply the patch

The "Install from URL" task should work now.

Ref: Old bug tracker: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33316

avatar elkuku elkuku - open - 20 Feb 2014
avatar brianteeman
brianteeman - comment - 20 Feb 2014

What are the "special cases" that it will fail on. I just tried "Install from URL" task with the following URL:
https://github.com/jtester/TestExtension/archive/1.0.zip
and it worked perfectly

avatar elkuku
elkuku - comment - 20 Feb 2014

it worked perfectly

Umm, I didn't expect this...

The "special case" I am talking about is actually what GitHub is doing here.
It took me a while to figure out why it doesn't work (for me), but since you asked for the details, here they are :wink:

The URL
https://github.com/jtester/TestExtension/archive/1.0.zip
does not point to a "real file" but triggers the GitHub build thingy generating a redirect to:
https://codeload.github.com/jtester/TestExtension/zip/1.0
passing the filename in the header:
attachment; filename=TestExtension-1.0.zip
Note that there are no quotes so this code:

https://github.com/joomla/joomla-cms/blob/master/libraries/cms/installer/helper.php#L63

$contentfilename = explode("\"", $response->headers['Content-Disposition']);
$target = $contentfilename[1];

will fail miserably, producing also a PHP notice when accessing the item 1 of an array with 1 entry... all this happens silently leaving the URL path as a fall back:
/path/to/joomla/tmp/1.0
with the resulting file name
1.0
Since JArchive relies on the file extension, it can not unpack a file with the extension 0, resulting in a Exception with the message: Unknown Archive Type which is also silently ignored...

Final result: "Unable to find install package"

Now, why this happens to me and not to you, I have honestly no idea.

If you have debugging capabilities, please set a breakpoint in the installer helper #64, otherwise could you just hack a

echo $response->headers['Content-Disposition'];die;

in there ?

Another test (which is why this is bugging me...) Could you switch to the "Install from web" tab - the JED thingy - and search for the "EasyCreator" extension? Does this also install OK?

Thanks for testing :)

avatar brianteeman
brianteeman - comment - 20 Feb 2014

yes easy creator installs fine

avatar brianteeman
brianteeman - comment - 20 Feb 2014

Not sure I added the echo correctly but it gave
Notice: Undefined offset: 1 in /Applications/MAMP/htdocs/newjab/libraries/cms/installer/helper.php on line 64
attachment; filename=TestExtension-1.0.zip

avatar elkuku
elkuku - comment - 20 Feb 2014

Now I am even more confused since you even get the notice I was talking about...

Could I ask you again to hack a

echo $target; die;

and then

echo $url; die;

at the end of the method (before the return statement)?
In my case this gives me the URL /path/to/joomla/tmp/1.0 leading to the errors described.

Thanks again ;)

avatar brianteeman
brianteeman - comment - 20 Feb 2014

Sorry do you mean making the code look like

// Return the name of the downloaded package
    echo $target; die;
    echo $url; die;
    return basename($target);
avatar elkuku
elkuku - comment - 20 Feb 2014

like this:

// Bump the max execution time because not using built in php zip libs are slow
@set_time_limit(ini_get('max_execution_time'));

print_r(array($target, $url)); die;

// Return the name of the downloaded package
return basename($target);
avatar brianteeman
brianteeman - comment - 20 Feb 2014
Array ( [0] => /Applications/MAMP/htdocs/newjab/tmp/1.0.zip [1] => https://github.com/jtester/TestExtension/archive/1.0.zip )
avatar elkuku
elkuku - comment - 20 Feb 2014

That's not what I expected either... but you still get the notice ?

Your output contains the original URL while mine contains the URL from the redirect e.g.
Array ( [0] => /home/elkuku/repos/joomla-cms/tmp/1.0 [1] => https://codeload.github.com/jtester/TestExtension/zip/1.0 )

I'm lost :(

avatar brianteeman
brianteeman - comment - 20 Feb 2014

Yes i still get the notice
Sorry I cant help any further

avatar Bakual
Bakual - comment - 20 Feb 2014

Maybe related to PHP version?
I can reproduce the issue on my test server and patch fixes the issue.

avatar brianteeman
brianteeman - comment - 20 Feb 2014

I was testing locally on PHP Version 5.4.10
Just tested on my live server PHP Version 5.3.28 and got the error

avatar Bakual
Bakual - comment - 20 Feb 2014

Tested both on PHP 5.3.23 and 5.4.20 and got the error. So it's likely not related to that :smile:

avatar elkuku
elkuku - comment - 20 Feb 2014

I'm on PHP 5.5.9 ;)

avatar infograf768
infograf768 - comment - 25 Feb 2014

@test
before patch I get the same error as Brian i.e.
PHP Notice: Undefined offset: 1 in /Applications/MAMP/htdocs/trunkgitnew/libraries/cms/installer/helper.php on line 71
But the component installs fine.

No more Notice after patch

avatar phproberto
phproberto - comment - 26 Feb 2014

I sorry. I missed this one and sent a PR for the same yesterday.

@elkuku can you review it? I think it's a simpler solution because instead of check double quotes and then basename= it direcly uses =.

Related PR: #3182

avatar elkuku elkuku - change - 26 Feb 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-02-26 14:40:45
avatar elkuku elkuku - close - 26 Feb 2014
avatar elkuku
elkuku - comment - 26 Feb 2014

Closing in favor of #3182

avatar elkuku elkuku - close - 26 Feb 2014
avatar elkuku elkuku - head_ref_deleted - 26 Feb 2014

Add a Comment

Login with GitHub to post a comment