diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php
index 3e8ff83fcd4..f5c3453a651 100644
--- a/cake/libs/view/helpers/html.php
+++ b/cake/libs/view/helpers/html.php
@@ -343,7 +343,7 @@ function css($path, $rel = null, $htmlAttributes = array(), $inline = true) {
}
if (strpos($path, '?') === false) {
- if (substr($path, -4) !== '.css') {
+ if (!preg_match('/.*\.(css|php)$/i', $path)) {
$path .= '.css';
}
}
diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php
index ec66579aa8f..ce744b9096c 100644
--- a/cake/libs/view/helpers/javascript.php
+++ b/cake/libs/view/helpers/javascript.php
@@ -248,7 +248,7 @@ function link($url, $inline = true) {
$url = JS_URL . $url;
}
if (strpos($url, '?') === false) {
- if (substr($url, -3) !== '.js') {
+ if (!preg_match('/.*\.(js|php)$/i', $url)) {
$url .= '.js';
}
}
diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php
index d6d3be54ee0..701ca27e918 100644
--- a/cake/tests/cases/libs/view/helpers/html.test.php
+++ b/cake/tests/cases/libs/view/helpers/html.test.php
@@ -365,6 +365,10 @@ function testCssLink() {
$expected['link']['href'] = 'preg:/.*css\/my\.css\.library\.css/';
$this->assertTags($result, $expected);
+ $result = $this->Html->css('my.css.php');
+ $expected['link']['href'] = 'preg:/.*css\/my\.css\.php/';
+ $this->assertTags($result, $expected);
+
$result = $this->Html->css('screen.css?1234');
$expected['link']['href'] = 'preg:/.*css\/screen\.css\?1234/';
$this->assertTags($result, $expected);
diff --git a/cake/tests/cases/libs/view/helpers/javascript.test.php b/cake/tests/cases/libs/view/helpers/javascript.test.php
index 83c1b74d05c..fcc1c188197 100644
--- a/cake/tests/cases/libs/view/helpers/javascript.test.php
+++ b/cake/tests/cases/libs/view/helpers/javascript.test.php
@@ -173,8 +173,8 @@ function testLink() {
$expected = '';
$this->assertEqual($result, $expected);
- $result = $this->Javascript->link('jquery-1.1.2');
- $expected = '';
+ $result = $this->Javascript->link('jquery-1.1.2.php');
+ $expected = '';
$this->assertEqual($result, $expected);
$result = $this->Javascript->link('/plugin/js/jquery-1.1.2');