diff --git a/doc/changelog.txt b/doc/changelog.txt index 05574ca9..214e00ee 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -5,6 +5,12 @@ Fixes: Closes: SF bug #3528450 - checking: Fix writing temporary files. +Changes: +- checking: Ignore URLs from local PHP files with execution + directives of the form "". + Prevents false errors when checking local PHP files. + Closes: SF bug #3532763 + Features: - installation: Support RPM building with cx_Freeze. - installation: Added .desktop files for POSIX systems. diff --git a/linkcheck/checker/__init__.py b/linkcheck/checker/__init__.py index e56bdd74..8352b867 100644 --- a/linkcheck/checker/__init__.py +++ b/linkcheck/checker/__init__.py @@ -50,7 +50,7 @@ def absolute_url (base_url, base_ref, parent_url): def get_url_from (base_url, recursion_level, aggregate, parent_url=None, base_ref=None, line=0, column=0, - name=u""): + name=u"", parent_content_type=None): """ Get url data from given base data. @@ -86,7 +86,12 @@ def get_url_from (base_url, recursion_level, aggregate, if not (url or name): # use filename as base url, with slash as path seperator name = base_url.replace("\\", "/") - klass = get_urlclass_from(url) + if parent_content_type == 'application/x-httpd-php' and \ + 'Bla + +PHP 1 +PHP 2 diff --git a/tests/checker/data/file.php.result b/tests/checker/data/file.php.result index 9f28238e..f033f56e 100644 --- a/tests/checker/data/file.php.result +++ b/tests/checker/data/file.php.result @@ -9,3 +9,17 @@ cache key file://%(curdir)s/%(datadir)s/anchor.html real url file://%(curdir)s/%(datadir)s/anchor.html name Bla valid + +url test_ +cache key file://%(curdir)s/%(datadir)s/test_%%3C?%%20echo%%20%%24module%%20?%%3E +real url file://%(curdir)s/%(datadir)s/test_%%3C?%%20echo%%20%%24module%%20?%%3E +name PHP 1 +warning File URL ignored. +valid + +url test_ +cache key file://%(curdir)s/%(datadir)s/test_%%3C?php%%20echo%%20%%24module%%20?%%3E +real url file://%(curdir)s/%(datadir)s/test_%%3C?php%%20echo%%20%%24module%%20?%%3E +name PHP 2 +warning File URL ignored. +valid