Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
javascript
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Aug 2013 at 19:20 UTC
Updated:
29 Jul 2014 at 22:43 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
berdirThis is green.
As often with this, this could actually indicate a real and weird bug with this shorthand version. Because what happens is basically this:
Not sure if there's a useful way to test this, though.
Comment #2
berdirComment #3
alexpottI can confirm that this fixes the issue. I've tested on php 5.4 and 5.5 and the fix looks great.
Comment #4
webchickI think we need test coverage for this new chunk of code, no?
Comment #5
berdirWell, we already have test coverage for that case, that's what's causing the exception in 5.4. The problem is that the bug shows in a weird way, not sure how to write a useful test for this:
What happens in 8.x is this output:
And with the fix
So in 8.x, we have two entries. One that is correct, including the correct version and a broken one with the -.
Looking into this, I noticed that the shorthand => array() conversion already happens in drupal_get_library(), but it doesnt' remove the old entry. And my change actually broke the correct version handling there. So removed that and added an unset() in drupal_get_library().
The assert once test addition is kinda weird, but this combined should fail both with my previous patch and HEAD.
webchick++
Comment #6
alexpottSo as we don't have any 5.4 or 5.5 bots we're not going to see any fails here.
I can confirm that on 5.4 and 5.5
javascript-array-illegal-offset-2056737-5-HEAD-test-only.patchfails with an exception and on the assertion that only 1 shorthand.js files in the array.I can also confirm that
javascript-array-illegal-offset-2056737-5.patchfixes the exception and passes the test. Nice work @berdir and @webchick. This look even better to me than the patch in #1 - so rtbc :)Comment #7
berdirAh, the reason the first test doesn't fail on 5.3 is this.
This is already converted to !isset($options[0]) and $options is a string, so it is set and never goes into the if.
Crazy stuff.
Comment #8
dries commentedGreat work and RTBC per Alex. Committed to 8.x. Thanks!