aboutsummaryrefslogtreecommitdiffstats
path: root/php.req
diff options
context:
space:
mode:
Diffstat (limited to 'php.req')
-rwxr-xr-xphp.req8
1 files changed, 5 insertions, 3 deletions
diff --git a/php.req b/php.req
index 6c5b81c..1ba5cd7 100755
--- a/php.req
+++ b/php.req
@@ -35,10 +35,10 @@ foreach (@ARGV ? $ARGV : <> ) {
while (<F>) {
# skip comments
next if (/^\s*(#|\/\/|\*|\/\*)/);
-
while (/(\W|^)(require|include)(_once)?
\s* \(? \s* ("([^"]*)"|'([^']*)')
\s* \)? \s* ;/xg) {
+
if ($5 ne "") {
$x = $5;
} elsif ($6 ne "") {
@@ -46,7 +46,8 @@ foreach (@ARGV ? $ARGV : <> ) {
} else {
next;
}
-
+ do $x =~ s/\/\.?\//\//g while $x =~ /\/\.?\//;
+ do $x =~ s/(\/|^)[^\/]*[^.]\/\.\.\//\1/g while $x =~ /(\/|^)[^\/]*[^.]\/\.\.\//;
next if ($x =~ m|^\.\.?/| or $x =~ /\$/);
next unless ($x =~ /\.php$/);
$req{$x} = 1;
@@ -69,7 +70,8 @@ foreach (@ARGV ? $ARGV : <> ) {
next unless ($x =~ /\.php$/);
$x = "$file_dir/$x";
- $x =~ s|/+|/|g;
+ do $x =~ s/\/\.?\//\//g while $x =~ /\/\.?\//;
+ do $x =~ s/(\/|^)[^\/]*[^.]\/\.\.\//\1/g while $x =~ /(\/|^)[^\/]*[^.]\/\.\.\//;
$req{$x} = 1;
}
}