From 2eb641e19d90a1c6aa1940ba92687c75e5afd353 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 18 Aug 2005 17:31:37 +0000 Subject: Also fix */../* */./* *//* --- php.req | 8 +++++--- 1 file 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 () { # 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; } } -- cgit v1.2.1