#106: Filter algorithm is broken for namespaced internal classes
Issue revisions
- new by Manuel Pichler at 2009-D-25 9:12
- assigned by Manuel Pichler at 2009-D-25 9:13
- assigned by Manuel Pichler at 2009-D-25 9:13
- assigned by Manuel Pichler at 2009-D-26 9:45
- assigned by Manuel Pichler at 2009-D-26 21:56
- closed by Manuel Pichler at 2010-J-30 9:23
| Type | |
|---|---|
| State | |
| Priority | |
| Resolution | |
| Assigned to | Manuel Pichler |
| Scheduled for | 0.9.10 |
| Affected versions | 0.9.8, 0.9.x-svn |
| Affected components | Parser, Logger |
| Last change | Saturday 30 January 2010 09:23:47 UTC by Manuel Pichler |
Short description
PHP_Depend's filter algorithm that strips internal classes from generated log files is broken for internal class names that are prefixed with a backslash.
Environment
PHP Version: 5.3.x OS: Any
Steps to reproduce
The following code can be used to test this behavior:
<?php
/* /tmp/bug.php */
/**
* @package foo
*/
class Bar
{
function baz()
{
throw new \RuntimeException('E_BAZ');
}
}
Running it with:
mapi@arwen ~ $ pdepend --summary-xml=/tmp/sum.xml /tmp/bug.php
Expected behavior
The expected output file is:
<?xml version="1.0" encoding="UTF-8"?>
<metrics generated="2009-12-25T09:38:15" pdepend="0.9.8" ahh="0" ...>
<files>
<file name="/tmp/pdepend.php" ... />
</files>
<package name="foo" cr="0.15" ...>
<class name="Bar" cis="1" ...>
<file name="/tmp/pdepend.php" />
<method name="baz" ccn="1" ... />
</class>
</package>
</metrics>
Actual behavior
But the currently generated log file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<metrics generated="2009-12-25T09:38:15" pdepend="0.9.8" ahh="0" ...>
<files>
<file name="/tmp/pdepend.php" ... />
</files>
<package name="" cr="0.15" ...>
<class name="RuntimeException" cis="0" ... />
</package>
<package name="foo" cr="0.15" ...>
<class name="Bar" cis="1" ...>
<file name="/tmp/pdepend.php" />
<method name="baz" ccn="1" ... />
</class>
</package>
</metrics>
Manuel Pichler at Friday 25 December 2009 09:13:56 UTC
Scheduled for PHP_Depend 0.9.9
Manuel Pichler at Saturday 26 December 2009 09:45:33 UTC
Typo in title fixed.
Manuel Pichler at Saturday 26 December 2009 21:56:43 UTC
Rescheduled for 0.9.10
rwilczek at Friday 29 January 2010 09:30:11 UTC
Having internal classes and interfaces in the logfile allows to track for dependencies. This is a very nice feature and should IMHO not be dropped. I like to see which internal classes/interfaces are actually required by my system.
Manuel Pichler at Saturday 30 January 2010 09:23:13 UTC
Okay, that's a valid use case, but the current behavior is really a bug and not feature of PHP_Depend. As it only occures with PHP >= 5.3.0 and when namespaces are utilized by the application.
But your use case should be solvable with a five liner, using the static reflection component
Manuel Pichler at Saturday 30 January 2010 09:23:47 UTC
Fixed in svn revision #1039.