Tomasz Klim - 2008-03-05

Logged In: YES
user_id=910879
Originator: NO

Hello

This error happens, when you scan the multi-level directory tree with code, and is simply a result of bad parser assumption to have %allfiles variable always filled with files from all subdirectories. In the below patch, I changed this behaviour to just check, if a required file physically exists in any possible location, which fixes the problem.

--- orig/phpxref.pl 2007-01-03 04:21:49.000000000 +0100
+++ tkl/phpxref.pl 2008-03-05 15:28:26.000000000 +0100
@@ -480,7 +481,8 @@
}
$pn =~ s|/+|/|;
$pn=collapse_path($pn);
- if ($allfiles{$pn}) {
+ if (-f $pn) {
+ $pn =~ s/$source_dir//g;
return($pn);
}
}
@@ -583,17 +585,35 @@
}
}
$reqname=join('',@parts);
- #print "Resolving $reqname\n";
- return unless $pn=resolve_path($reqname);
- push(@{$require_references{$pn}},
- {
- 'subdir' => "$subdir/",
- 'filename' => $filename,
- 'line' => $line
- }
- );
- $filerequires{"$subdir/$filename"}{$pn}=1;
- $parsed_requires{$orgreqname}=$pn;
+ #return unless $pn=resolve_path($reqname);
+
+ $pn=resolve_path(basename($reqname));
+ if ($pn) {
+
+ push(@{$require_references{$pn}},
+ {
+ 'subdir' => "$subdir/",
+ 'filename' => $filename,
+ 'line' => $line
+ }
+ );
+ $filerequires{"$subdir/$filename"}{$pn}=1;
+ $parsed_requires{basename($orgreqname)}=$pn;
+
+ } else {
+
+ return unless $pn=resolve_path($reqname);
+ push(@{$require_references{$pn}},
+ {
+ 'subdir' => "$subdir/",
+ 'filename' => $filename,
+ 'line' => $line
+ }
+ );
+ $filerequires{"$subdir/$filename"}{$pn}=1;
+ $parsed_requires{$orgreqname}=$pn;
+ }
+
return 1;
}