Commit a2d78da0 authored by Dries's avatar Dries
Browse files

- Patch #605552 by dereine, mr.baileys: function l() fragment 0 return not #0.

parent 3968a954
...@@ -2049,7 +2049,7 @@ function url($path = NULL, array $options = array()) { ...@@ -2049,7 +2049,7 @@ function url($path = NULL, array $options = array()) {
// Allow other modules to alter the outbound URL and options. // Allow other modules to alter the outbound URL and options.
drupal_alter('url_outbound', $path, $options, $original_path); drupal_alter('url_outbound', $path, $options, $original_path);
if ($options['fragment']) { if (isset($options['fragment']) && $options['fragment'] !== '') {
$options['fragment'] = '#' . $options['fragment']; $options['fragment'] = '#' . $options['fragment'];
} }
......
...@@ -268,6 +268,14 @@ class CommonURLUnitTest extends DrupalWebTestCase { ...@@ -268,6 +268,14 @@ class CommonURLUnitTest extends DrupalWebTestCase {
$result = url('node/123', array('query' => array('foo' => NULL), 'fragment' => 'bar', 'absolute' => $absolute)); $result = url('node/123', array('query' => array('foo' => NULL), 'fragment' => 'bar', 'absolute' => $absolute));
$this->assertEqual($url, $result, "$url == $result"); $this->assertEqual($url, $result, "$url == $result");
$url = $base . '?q=node/123&foo#0';
$result = url('node/123', array('query' => array('foo' => NULL), 'fragment' => '0', 'absolute' => $absolute));
$this->assertEqual($url, $result, "$url == $result");
$url = $base . '?q=node/123&foo';
$result = url('node/123', array('query' => array('foo' => NULL), 'fragment' => '', 'absolute' => $absolute));
$this->assertEqual($url, $result, "$url == $result");
$url = $base; $url = $base;
$result = url('<front>', array('absolute' => $absolute)); $result = url('<front>', array('absolute' => $absolute));
$this->assertEqual($url, $result, "$url == $result"); $this->assertEqual($url, $result, "$url == $result");
......
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