Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.15

Bug #14537 PHP_Beautifier breaks php 5.3 code
Submitted: 2008-08-21 19:36 UTC
From: berdir Assigned: clbustos
Status: Closed Package: PHP_Beautifier (version 0.1.14)
PHP Version: 5.2.6 OS: Linux
Roadmaps: 1.0.0RC1    
Subscription  


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 8 + 48 = ?

 
 [2008-08-21 19:36 UTC] berdir (Sascha Grossenbacher)
Description: ------------ PHP_Beautifier removes whitespaces after php 5.3 statements like namespace and use which breaks the code. Test script: --------------- namespace A; use B; Expected result: ---------------- namespace A; use B; Actual result: -------------- namespaceA; useB;

Comments

 [2008-08-27 07:21 UTC] doconnor (Daniel O'Connor)
Hi Sascha, I don't suppose you want to turn that into a quick executable test for us do you?
 [2008-08-27 08:01 UTC] berdir (Sascha Grossenbacher)
I created a new function inside Beautifier_Bugs.phpt, which does a simple test. Feel free to extend or change it if it isn't what you need ;) /** * Bug 14537 * PHP_Beautifier breaks code with namespace and/or use statements */ function testBug14537() { $sText = <<<SCRIPT <?php namespace MyTestnamespace.someSubNS; use OtherNamespace::ClassA; use AnotherNamespace::Class1 as Class2; ?> SCRIPT; $this->setText($sText); $sExpected = <<<SCRIPT <?php namespace MyTestnamespace.someSubNS; use OtherNamespace::ClassA; use AnotherNamespace::Class1 as Class2; ?> SCRIPT; $this->assertEquals($sExpected, $this->oBeaut->get()); } Actual Output is: TestCase Beautifier_Bugs->testBug14537() failed: expected <?php namespace MyTestnamespace.someSubNS; use OtherNamespace::ClassA; use AnotherNamespace::Class1 as Class2; ?>, actual <?php namespaceMyTestnamespace . someSubNS; useOtherNamespace::ClassA; useAnotherNamespace::Class1 as Class2; ?> in /usr/share/php/tests/PHP_Beautifier/tests/Beautifier_Bugs.phpt:106 I can upload it as a diff, if needed... I am not sure if it useful in this case as this file has probably changed in cvs.
 [2008-08-27 16:49 UTC] clbustos (Claudio Bustos)
Please, upload the diff, berdir. Someone with PHP 5.3 can add the tokens to PHP_Beautifier class?
 [2009-10-29 15:44 UTC] desfrenes (Mickaël Desfrênes)
Add this to Beautifier.php, at line 306 T_NAMESPACE => 'T_INCLUDE', T_USE => 'T_INCLUDE', will only work when PHP_Beautifier is executed by PHP5.3 because T_NAMESPACE and T_USE don't exist in previous versions.
 [2010-03-16 11:07 UTC] clbustos (Claudio Bustos)
-Status: Open +Status: Closed -Assigned To: +Assigned To: clbustos
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.