diff --git a/system/Helpers/html_helper.php b/system/Helpers/html_helper.php index a15b18ff47e8..c2e48d890fef 100755 --- a/system/Helpers/html_helper.php +++ b/system/Helpers/html_helper.php @@ -189,8 +189,8 @@ function doctype(string $type = 'html5'): string * * Generates link to a JS file * - * @param mixed $src Script source or an array - * @param bool $indexPage Should indexPage be added to the JS path + * @param array|string $src Script source or an array of attributes + * @param bool $indexPage Should indexPage be added to the JS path */ function script_tag($src = '', bool $indexPage = false): string { diff --git a/tests/system/Helpers/HTMLHelperTest.php b/tests/system/Helpers/HTMLHelperTest.php index 74b087228fdd..d539d7421be6 100755 --- a/tests/system/Helpers/HTMLHelperTest.php +++ b/tests/system/Helpers/HTMLHelperTest.php @@ -269,6 +269,16 @@ public function testScriptTagWithSrcAndAttributes() $this->assertSame($expected, script_tag($target)); } + /** + * This test has probably no real-world value but may help detecting + * a change in the default behaviour. + */ + public function testScriptTagWithoutAnyArg() + { + $expected = ''; + $this->assertSame($expected, script_tag()); + } + public function testLinkTag() { $target = 'css/mystyles.css'; diff --git a/user_guide_src/source/changelogs/v4.2.0.rst b/user_guide_src/source/changelogs/v4.2.0.rst index 0ed69ab0760a..fa88608dc355 100644 --- a/user_guide_src/source/changelogs/v4.2.0.rst +++ b/user_guide_src/source/changelogs/v4.2.0.rst @@ -38,6 +38,7 @@ Enhancements - The log format has also changed. If users are depending on the log format in their apps, the new log format is "<1-based count> (): " - Added support for webp files to **app/Config/Mimes.php**. - Added 4th parameter ``$includeDir`` to ``get_filenames()``. See :php:func:`get_filenames`. +- HTML helper ``script_tag()`` now uses ``null`` values to write boolean attributes in minimized form: ``