Commit 439d53aa authored by Dries's avatar Dries

Issue #2056737 by Berdir: Illegal string offset test exceptions in PHP 5.4 in drupal_add_library().

parent 394b9d15
......@@ -2834,7 +2834,9 @@ function drupal_get_library($module, $name = NULL) {
if (is_scalar($options)) {
// The JavaScript or CSS file has been specified in shorthand
// format, without an array of options. In this case $options is the
// filename.
// filename. Convert the shorthand version and remove the old array
// key.
unset($module_libraries[$key]['js'][$file]);
$file = $options;
$options = array();
}
......
......@@ -480,9 +480,10 @@ function testLibraryRender() {
$this->assertTrue(strpos($styles, 'core/assets/vendor/farbtastic/farbtastic.css'), 'Stylesheet of library was added to the page.');
$result = drupal_add_library('common_test', 'shorthand.plugin');
$path = drupal_get_path('module', 'common_test') . '/js/shorthand.js';
$path = drupal_get_path('module', 'common_test') . '/js/shorthand.js?v=0.8.3.37';
$scripts = drupal_get_js();
$this->assertTrue(strpos($scripts, $path), 'JavaScript specified in hook_library_info() using shorthand format (without any options) was added to the page.');
$this->assertEqual(substr_count($scripts, 'shorthand.js'), 1, 'Shorthand JavaScript file only added once.');
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment