Hi i'm new user of Geany on Linux. I want to use PHP_Beautifier Pear package (0.1.5) in Geany. I follow this tutorial http://44studio.blogspot.it/2012/09/php-beautifier-with-geany.html but nothing happens: no code formatted nor changed. Where I get the new formatted code? Where is the mistake?
Thanks!
On 24 November 2012 22:04, barz040@yahoo.it barz040@yahoo.it wrote:
Hi i'm new user of Geany on Linux. I want to use PHP_Beautifier Pear package (0.1.5) in Geany. I follow this tutorial http://44studio.blogspot.it/2012/09/php-beautifier-with-geany.html but nothing happens: no code formatted nor changed. Where I get the new formatted code? Where is the mistake?
Not much info to help.
Do whatever commands you have configured run correctly in the command line?
Configure a really simple command in Geany and see if it works.
Cheers Lex
Thanks!
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Yes, if I run: php_beautifier -f /home/user/public_html/input.php -o /home/user/public_html/output.php -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)" it works fine.
If I run this simple command in Geany: sed 's/./(dot)/g' it works fine.
The string that I use in Geany is this: php_beautifier -s4 -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)"
but without results.
----- Messaggio originale ----- Da: Lex Trotman elextr@gmail.com A: "barz040@yahoo.it" barz040@yahoo.it; Geany general discussion list users@lists.geany.org Cc: Inviato: Sabato 24 Novembre 2012 12:13 Oggetto: Re: [Geany-Users] PHP_Beautifier
On 24 November 2012 22:04, barz040@yahoo.it barz040@yahoo.it wrote:
Hi i'm new user of Geany on Linux. I want to use PHP_Beautifier Pear package (0.1.5) in Geany. I follow this tutorial http://44studio.blogspot.it/2012/09/php-beautifier-with-geany.html but nothing happens: no code formatted nor changed. Where I get the new formatted code? Where is the mistake?
Not much info to help.
Do whatever commands you have configured run correctly in the command line?
Configure a really simple command in Geany and see if it works.
Cheers Lex
Thanks!
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 24/11/12 13:32, barz040@yahoo.it wrote:
Yes, if I run: php_beautifier -f /home/user/public_html/input.php -o /home/user/public_html/output.php -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)" it works fine.
If I run this simple command in Geany: sed 's/./(dot)/g' it works fine.
The string that I use in Geany is this: php_beautifier -s4 -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)"
but without results.
Just a guess:
Did you select the text before using the command? That feature completely relies on a text selection, if no text is selected, nothing happens.
To format a complete file, simply use Ctrl-A before to select all.
Regards, Enrico
yes, I select all text before using the command.
Just a guess:
Did you select the text before using the command? That feature completely relies on a text selection, if no text is selected, nothing happens.
To format a complete file, simply use Ctrl-A before to select all.
Regards, Enrico
On 12-11-24 04:32 AM, barz040@yahoo.it wrote:
Yes, if I run: php_beautifier -f /home/user/public_html/input.php -o /home/user/public_html/output.php -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)" it works fine.
Try running it same as the Geany version from the command line, ex:
$ echo "Some PHP Code Here" | php_beautifier -s4 -l "..." or $ cat "some-code-file.php" | php_beautifier -s4 -l "..."
Cheers, Matthew Brush
On 25 November 2012 06:51, Matthew Brush mbrush@codebrainz.ca wrote:
On 12-11-24 04:32 AM, barz040@yahoo.it wrote:
Yes, if I run: php_beautifier -f /home/user/public_html/input.php -o /home/user/public_html/output.php -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)" it works fine.
What platform are you on? Version of Geany, version of GTK and Glib, from help->debug messages? Look for error messages in help->debug messages.
Cheers Lex
Try running it same as the Geany version from the command line, ex:
$ echo "Some PHP Code Here" | php_beautifier -s4 -l "..." or $ cat "some-code-file.php" | php_beautifier -s4 -l "..."
Cheers, Matthew Brush
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Try running it same as the Geany version from the command line, ex: $ echo "Some PHP Code Here" | php_beautifier -s4 -l "..." or $ cat "some-code-file.php" | php_beautifier -s4 -l "..."
done. Both the commands work fine in terminal.
What platform are you on? Version of Geany, version of GTK and Glib, from help->debug messages? Look for error messages in help->debug messages.
Xubuntu 12.10, Geany 1.22, GTK 2.24.13
Those are the error messages in Help>Debug:
11:03:17: Geany WARNING : php_beautifier -s4 -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)": PHP Strict Standards: Non-static method Console_Getopt::readPHPArgv() should not be called statically in /usr/bin/php_beautifier on line 70 PHP Strict Standards: Non-static method Console_Getopt::getopt() should not be called statically in /usr/bin/php_beautifier on line 84 PHP Strict Standards: Non-static method Console_Getopt::doGetopt() should not be called statically in /usr/share/php/Console/Getopt.php on line 92 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /usr/share/php/Console/Getopt.php on line 109 PHP Strict Standards: Non-static method Console_Getopt::_parseShortOption() should not be called statically in /usr/share/php/Console/Getopt.php on line 166 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /usr/share/php/Console/Getopt.php on line 167 PHP Strict Standards: Non-static method Console_Getopt::_parseShortOption() should not be called statically in /usr/share/php/Console/Getopt.php on line 166 PHP Strict Standards: Non-static method Console_Getopt::_isShortOpt() should not be called statically in /usr/share/php/Console/Getopt.php on line 220 PHP Strict Standards: Non-static method Console_Getopt::_isLongOpt() should not be called statically in /usr/share/php/Console/Getopt.php on line 221 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /usr/share/php/Console/Getopt.php on line 167 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /usr/bin/php_beautifier on line 85
Those same messages are also shown in terminal but all works however!
On 25 November 2012 21:11, barz040@yahoo.it barz040@yahoo.it wrote:
Try running it same as the Geany version from the command line, ex: $ echo "Some PHP Code Here" | php_beautifier -s4 -l "..." or $ cat "some-code-file.php" | php_beautifier -s4 -l "..."
done. Both the commands work fine in terminal.
What platform are you on? Version of Geany, version of GTK and Glib, from help->debug messages? Look for error messages in help->debug messages.
Xubuntu 12.10, Geany 1.22, GTK 2.24.13
Those are the error messages in Help>Debug:
11:03:17: Geany WARNING : php_beautifier -s4 -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)": PHP Strict Standards: Non-static method Console_Getopt::readPHPArgv() should not be called statically in /usr/bin/php_beautifier on line 70 PHP Strict Standards: Non-static method Console_Getopt::getopt() should not be called statically in /usr/bin/php_beautifier on line 84 PHP Strict Standards: Non-static method Console_Getopt::doGetopt() should not be called statically in /usr/share/php/Console/Getopt.php on line 92 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /usr/share/php/Console/Getopt.php on line 109 PHP Strict Standards: Non-static method Console_Getopt::_parseShortOption() should not be called statically in /usr/share/php/Console/Getopt.php on line 166 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /usr/share/php/Console/Getopt.php on line 167 PHP Strict Standards: Non-static method Console_Getopt::_parseShortOption() should not be called statically in /usr/share/php/Console/Getopt.php on line 166 PHP Strict Standards: Non-static method Console_Getopt::_isShortOpt() should not be called statically in /usr/share/php/Console/Getopt.php on line 220 PHP Strict Standards: Non-static method Console_Getopt::_isLongOpt() should not be called statically in /usr/share/php/Console/Getopt.php on line 221 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /usr/share/php/Console/Getopt.php on line 167 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically in /usr/bin/php_beautifier on line 85
Those same messages are also shown in terminal but all works however!
Right, but Geany thinks that since it returned messages on stderr that something went wrong with the command, so it doesn't do the substitution. You should have a message along the line "The executed custom command returned an error. Your selection was not changed." in the status bar.
Cheers Lex
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Right, but Geany thinks that since it returned messages on stderr that
something went wrong with the command, so it doesn't do the substitution. You should have a message along the line "The executed custom command returned an error. Your selection was not changed." in the status bar.
Those are the first 2 messages (before of "PHP Strict Standards" posted from me):
11:37:07: Passing data and executing custom command: php_beautifier -s4 -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)" 11:37:08: The executed custom command returned an error. Your selection was not changed. Error message: PHP Strict Standards: Non-static method Console_Getopt::readPHPArgv() should not be called statically in /usr/bin/php_beautifier on line 70
Le 25/11/2012 11:32, Lex Trotman a écrit :
On 25 November 2012 21:11, barz040@yahoo.it barz040@yahoo.it wrote:
Try running it same as the Geany version from the command line, ex: $ echo "Some PHP Code Here" | php_beautifier -s4 -l "..." or $ cat "some-code-file.php" | php_beautifier -s4 -l "..."
done. Both the commands work fine in terminal.
What platform are you on? Version of Geany, version of GTK and Glib, from help->debug messages? Look for error messages in help->debug messages.
Xubuntu 12.10, Geany 1.22, GTK 2.24.13
Those are the error messages in Help>Debug:
[...]
Those same messages are also shown in terminal but all works however!
Right, but Geany thinks that since it returned messages on stderr that something went wrong with the command, so it doesn't do the substitution. You should have a message along the line "The executed custom command returned an error. Your selection was not changed." in the status bar.
What's the point about it BTW? Normally a command exit status should be the way to check, I don't see why we should make weird guess at a command not being allowed to output something on stderr?
Anyway, for the OP: you can simply disable those non-fatal warnings, e.g. by passing the appropriate flag to PHP (not sure how PHP is called by your `php_beautifier` command, but it should be easy, e.g. `php -d ... php_beautifier ...`):
-d error_reporting='E_ALL & ~(E_STRICT|E_DEPRECATED|E_NOTICE)'
It will prevent PHP from whining about those strict standard stuff and so Geany won't think something went wrong.
Cheers, Colomban
Hi,
On Nov 25, 2012 3:42 PM, "Colomban Wendling" lists.ban@herbesfolles.org wrote:
Le 25/11/2012 11:32, Lex by your `php_beautifier` command, but it should be easy, e.g. `php -d ... php_beautifier ...`):
-d error_reporting='E_ALL & ~(E_STRICT|E_DEPRECATED|E_NOTICE)'
It is indeed the right way. And if this app sets another error level then I would suggest to report a bug upstream and patch it in the meantime.
[...]
Right, but Geany thinks that since it returned messages on stderr that something went wrong with the command, so it doesn't do the substitution. You should have a message along the line "The executed custom command returned an error. Your selection was not changed." in the status bar.
What's the point about it BTW? Normally a command exit status should be the way to check, I don't see why we should make weird guess at a command not being allowed to output something on stderr?
Well, I don't know the original argument for doing it this way, but I've got two:
1. the command is meant to be a filter, stdin to stdout, anything on stderr almost certainly indicates a problem.
2. sadly there are still filters that return zero if they fail and non-zero if they succeed (especially user written ones :), which means that you can't just test the return value.
Cheers Lex
[...]
On 12-11-25 02:44 PM, Lex Trotman wrote:
[...]
Right, but Geany thinks that since it returned messages on stderr that something went wrong with the command, so it doesn't do the substitution. You should have a message along the line "The executed custom command returned an error. Your selection was not changed." in the status bar.
What's the point about it BTW? Normally a command exit status should be the way to check, I don't see why we should make weird guess at a command not being allowed to output something on stderr?
Well, I don't know the original argument for doing it this way, but I've got two:
- the command is meant to be a filter, stdin to stdout, anything on
stderr almost certainly indicates a problem.
Filter programs sometimes use stderr as way to output status information/reports/warnings that shouldn't get piped to the normal output. IIRC the `tidy` utility does this by default.
- sadly there are still filters that return zero if they fail and
non-zero if they succeed (especially user written ones :), which means that you can't just test the return value.
Checking exit codes is pretty much the only sane way though and is the exact use for them.
Maybe checking exit code to determine success or failure and just having a status bar message if stderr is written to that says something to the effect of "The filter command wrote to the standard error stream, this might indicate a problem in your output." would be the way to go?
Cheers, Matthew Brush
On 26 November 2012 10:48, Matthew Brush mbrush@codebrainz.ca wrote:
On 12-11-25 02:44 PM, Lex Trotman wrote:
[...]
Right, but Geany thinks that since it returned messages on stderr that something went wrong with the command, so it doesn't do the substitution. You should have a message along the line "The executed custom command returned an error. Your selection was not changed." in the status bar.
What's the point about it BTW? Normally a command exit status should be the way to check, I don't see why we should make weird guess at a command not being allowed to output something on stderr?
Well, I don't know the original argument for doing it this way, but I've got two:
- the command is meant to be a filter, stdin to stdout, anything on
stderr almost certainly indicates a problem.
Filter programs sometimes use stderr as way to output status information/reports/warnings that shouldn't get piped to the normal output. IIRC the `tidy` utility does this by default.
Yep, but most can be told to "shutup unless its important", eg tidy -e or Colomban's suggestion for PHP
And if it *is* important then we don't want to do the substitution.
- sadly there are still filters that return zero if they fail and
non-zero if they succeed (especially user written ones :), which means that you can't just test the return value.
Checking exit codes is pretty much the only sane way though and is the exact use for them.
Agreed, it is the proper way, if only Geany did that from the beginning, now we will break any un-sane filters if we change Geany.
Maybe checking exit code to determine success or failure and just having a status bar message if stderr is written to that says something to the effect of "The filter command wrote to the standard error stream, this might indicate a problem in your output." would be the way to go?
Nobody notices status bar messages I'm afraid. And if some of the output is wrong (which is what the message said) then the user may not notice until they have saved the file, oops.
Sadly I don't think there is a solution that is not going to break someone's existing filters, so I suggest the easiest path of just leaving it alone :)
Cheers Lex
Cheers, Matthew Brush
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 12-11-25 06:42 AM, Colomban Wendling wrote:
Le 25/11/2012 11:32, Lex Trotman a écrit :
On 25 November 2012 21:11, barz040@yahoo.it barz040@yahoo.it wrote:
Try running it same as the Geany version from the command line, ex: $ echo "Some PHP Code Here" | php_beautifier -s4 -l "..." or $ cat "some-code-file.php" | php_beautifier -s4 -l "..."
done. Both the commands work fine in terminal.
What platform are you on? Version of Geany, version of GTK and Glib, from help->debug messages? Look for error messages in help->debug messages.
Xubuntu 12.10, Geany 1.22, GTK 2.24.13
Those are the error messages in Help>Debug:
[...]
Those same messages are also shown in terminal but all works however!
Right, but Geany thinks that since it returned messages on stderr that something went wrong with the command, so it doesn't do the substitution. You should have a message along the line "The executed custom command returned an error. Your selection was not changed." in the status bar.
What's the point about it BTW? Normally a command exit status should be the way to check, I don't see why we should make weird guess at a command not being allowed to output something on stderr?
I was reading the commit[1] and bug report[2] where this came from and am linking here since they're relevant and open in my browser already :) From a quick scan, the issue seems to be specifically here[3] where it sets the error flag after warning about output on stderr.
Cheers, Matthew Brush
[1] https://github.com/geany/geany/commit/697d6aff746ed1f6fe5d5545786881064de136... [2] http://sourceforge.net/tracker/index.php?func=detail&aid=1909452&gro... [3] https://github.com/geany/geany/blob/master/src/tools.c#L263
I was reading the commit[1] and bug report[2] where this came from and
am linking here since they're relevant and open in my browser already :) From a quick scan, the issue seems to be specifically here[3] where it sets the error flag after warning about output on stderr.
excuse me but from all your comments I'm lost. What should I do to get PhpBeatufier working?
On 12-11-27 11:25 AM, barz040@yahoo.it wrote:
I was reading the commit[1] and bug report[2] where this came from and
am linking here since they're relevant and open in my browser already :) From a quick scan, the issue seems to be specifically here[3] where it sets the error flag after warning about output on stderr.
excuse me but from all your comments I'm lost. What should I do to get PhpBeatufier working?
For now, use the workaround Colomban recommended by changing the command to (all on one line):
php -d error_reporting='E_ALL & ~(E_STRICT|E_DEPRECATED|E_NOTICE)' php_beautifier -s4 -l "..."
Or change it to (untested):
php_beautifier -s4 -l "..." 2>/dev/null
Or if you're on Windows (also untested):
php_beautifier -s4 -l "..." 2>NUL
It's needed because a lot of "filter" scripts like PhpBeautifier print diagnostics info (ex. those "PHP Strict Standards" messages) on stderr by default but Geany, being (overly) paranoid, assumes that if the filter command prints diagnostic messages it has failed.
A lot of the other stuff discussed is looking at the cause and potential solutions to the problem, in terms of fixing Geany itself (ie. not useful to you at the moment).
Cheers, Matthew Brush
For now, use the workaround Colomban recommended by changing the command to (all on one line):
>php -d error_reporting='E_ALL & ~(E_STRICT|E_DEPRECATED|E_NOTICE)' php_beautifier -s4 -l "..."
Or change it to (untested):
>php_beautifier -s4 -l "..." 2>/dev/null
Tried but without success: with the first string the selection is not changed nor there are error messages; with the second string I obtain the same error messages posted by me but, more, a last message as this: "Nov 28 20:28:54 php_beautifier [error] Can't match any file"
Le 28/11/2012 20:34, barz040@yahoo.it a écrit :
For now, use the workaround Colomban recommended by changing the
command to (all on one line):
php -d error_reporting='E_ALL & ~(E_STRICT|E_DEPRECATED|E_NOTICE)'
php_beautifier -s4 -l "..."
Or change it to (untested):
php_beautifier -s4 -l "..." 2>/dev/null
This one doesn't work because 2>/dev/null is a shell redirect which we obviously don't handle.
Tried but without success: with the first string the selection is not changed nor there are error messages;
Could you try it on your terminal directly? Maybe php_beautifier isn't found by PHP and then you need to pass the full path to it (gettable in your terminal using `which php_beautifier`). Also, make sure php_beautifier is actually a PHP script and not a wrapper that launches PHP itself, in which case you'd need to update it to add the appropriate options.
Regards, Colomban
with the second string I obtain the same error messages posted by me but, more, a last message as this: "Nov 28 20:28:54 php_beautifier [error] Can't match any file"
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Could you try it on your terminal directly? Maybe php_beautifier isn't
found by PHP and then you need to pass the full path to it (gettable in your terminal using `which php_beautifier`).
via terminal, this string give me the usual error messages but it works (it creates the test2.php file):
php -d error_reporting='E_ALL & ~(E_STRICT|E_DEPRECATED|E_NOTICE)' /usr/bin/php_beautifier -s4 -f /home/user/public_html/test.php -o /home/user/public_html/test2.php -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)"
those two strings in Geany do not work and return the usual error messages: /usr/bin/php_beautifier -s4 -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)" nor php -d error_reporting='E_ALL & ~(E_STRICT|E_DEPRECATED|E_NOTICE)' /usr/bin/php_beautifier -s4 -l "ArrayNested() NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT) IndentStyles(style=k&r)"