Removed stray ampersand in Requirements (fixes #1809)

Only happens with suffix_requirements=true
This commit is contained in:
Ingo Schommer 2013-04-30 00:33:21 +02:00
parent caaf5a2d78
commit cef955c8b9
2 changed files with 10 additions and 8 deletions

View File

@ -362,18 +362,18 @@ class RequirementsTest extends SapphireTest {
$backend->set_suffix_requirements(true); $backend->set_suffix_requirements(true);
$html = $backend->includeInHTML(false, $template); $html = $backend->includeInHTML(false, $template);
$this->assertRegexp('/RequirementsTest_a\.js\?m=[\d]*/', $html); $this->assertRegexp('/RequirementsTest_a\.js\?m=[\d]*"/', $html);
$this->assertRegexp('/RequirementsTest_b\.js\?m=[\d]*&foo=bar&bla=blubb/', $html); $this->assertRegexp('/RequirementsTest_b\.js\?m=[\d]*&foo=bar&bla=blubb"/', $html);
$this->assertRegexp('/RequirementsTest_a\.css\?m=[\d]*/', $html); $this->assertRegexp('/RequirementsTest_a\.css\?m=[\d]*"/', $html);
$this->assertRegexp('/RequirementsTest_b\.css\?m=[\d]*&foo=bar&bla=blubb/', $html); $this->assertRegexp('/RequirementsTest_b\.css\?m=[\d]*&foo=bar&bla=blubb"/', $html);
$backend->set_suffix_requirements(false); $backend->set_suffix_requirements(false);
$html = $backend->includeInHTML(false, $template); $html = $backend->includeInHTML(false, $template);
$this->assertNotContains('RequirementsTest_a.js=', $html); $this->assertNotContains('RequirementsTest_a.js=', $html);
$this->assertNotRegexp('/RequirementsTest_a\.js\?m=[\d]*/', $html); $this->assertNotRegexp('/RequirementsTest_a\.js\?m=[\d]*"/', $html);
$this->assertNotRegexp('/RequirementsTest_b\.js\?m=[\d]*&foo=bar&bla=blubb/', $html); $this->assertNotRegexp('/RequirementsTest_b\.js\?m=[\d]*&foo=bar&bla=blubb"/', $html);
$this->assertNotRegexp('/RequirementsTest_a\.css\?m=[\d]*/', $html); $this->assertNotRegexp('/RequirementsTest_a\.css\?m=[\d]*"/', $html);
$this->assertNotRegexp('/RequirementsTest_b\.css\?m=[\d]*&foo=bar&bla=blubb/', $html); $this->assertNotRegexp('/RequirementsTest_b\.css\?m=[\d]*&foo=bar&bla=blubb"/', $html);
} }
public function assertFileIncluded($backend, $type, $files) { public function assertFileIncluded($backend, $type, $files) {

View File

@ -810,6 +810,8 @@ class Requirements_Backend {
} }
$suffix .= substr($fileOrUrl, strpos($fileOrUrl, '?')+1); $suffix .= substr($fileOrUrl, strpos($fileOrUrl, '?')+1);
$fileOrUrl = substr($fileOrUrl, 0, strpos($fileOrUrl, '?')); $fileOrUrl = substr($fileOrUrl, 0, strpos($fileOrUrl, '?'));
} else {
$suffix = '';
} }
return "{$prefix}{$fileOrUrl}{$mtimesuffix}{$suffix}"; return "{$prefix}{$fileOrUrl}{$mtimesuffix}{$suffix}";
} else { } else {