Comments (24)
Could you show what your editor's source code is? (which is the input text to the PHP beautifier)
If an error occurred in the beautification process of your PHP source code, the output file may not have been created and therefore when the call to delete temporary output file was executed it was unnecessary (there is no existing output file since an error had occurred) and it errored again because it was attempting to delete a file that does not exist.
from atom-beautify.
Same trouble, code not formatted:
Beautifier work, but with warnings, like "Strict standards: Non-static method PEAR::isError() should not be called statically". PHP 5.5.11. PHP_Beautifier 0.1.15.
from atom-beautify.
Please paste your source code so I can quickly test later without having to retype and possibly mistype your code. Thank you for posting version numbers @BOOMER74
from atom-beautify.
So I am using:
<?php
function add($a, $b) {
return $a +$b; }
echo add(1,2);
and it beautifies correctly.
I will add a little more logging in the Console that you can send me to debug.
from atom-beautify.
v0.4.4 is the version with additional logging. Let me know how that goes.
from atom-beautify.
Log this: Beautifcation Error: Error {killed: false, code: 1, signal: null}
from atom-beautify.
Hey, sorry I didn't respond to this sooner. Only recently got atom installed and running again, it appears that the initial error I was having no longer occurs but I'm running into a new one now regardless. Using various code examples, and for consistencies sake, the one posted above too, I'm getting the following error:
Uncaught TypeError: Cannot read property 'split' of undefined /usr/local/share/atom/resources/app/node_modules/text-buffer/lib/range.js:48
No idea why that would be happening.
from atom-beautify.
Glad to hear the previous error is no longer persisting, @AndalfTheBeard.
That new error looks like the result of the beautification is undefined
instead of a string
containing the beautified source code. Can you confirm what version of Atom, Atom Beautify, and php_beautify you have, as well as some sample source code I can test for myself.
from atom-beautify.
Atom Version 0.121.0
Atom Beautify 0.6.2
PHP_Beautifier-0.1.15
running Xubuntu 14.04 LTS
I've tried various code samples, all resulted in the same error.
<?php
function add($a, $b) {
return $a +$b; }
echo add(1,2);
included, as it was the example you provided above.
from atom-beautify.
My beautification is working properly.
Before
<?php
function add($a, $b) {
return $a +$b; }
echo add(1,2);
After:
<?php
function add($a, $b) {
return $a + $b;
}
echo add(1, 2);
This (and even the previous error you and @BOOMER74 are experiencing) could be caused by an incorrect PATH
environment variable, and therefore it cannot find php_beautifier
.
Could you retrieve the php_beautifier
path using which php_beautier
. Mine for instance:
$ which php_beautifier
/Users/glavin/pear/bin/php_beautifier
And set your php_beautifier_path
variable in either your .jsbeautifyrc
file or in your Atom Beautify package settings:
I have put in some special code as a workaround for Node.js's issue with the PATH
environment variable with using exec
: https://github.com/Glavin001/atom-beautify/blob/master/lib/langs/cli-beautify.coffee#L40-L49
However, it may not be working in you cases. So by forcing the php_beautifier_path
, you should then be using the proper command and it should hopefully work not. Keep me posted!
from atom-beautify.
- Fix the the
PATH
workaround: correct.bash_rc
to.bashrc
at https://github.com/Glavin001/atom-beautify/blob/master/lib/langs/cli-beautify.coffee#L45
from atom-beautify.
@Glavin001 I have install atom-beautify
and php_beautifier
to third PC. Formatting work good. The problem was in the wrong PEAR
paths when installing php_beautifier
. Today I check this on other PC.
from atom-beautify.
Thanks for checking @BOOMER74. I will be adding more setup document for languages like PHP that require the PATH ( #58 ). Hopefully that will help users like yourselves in the future from having this issue.
from atom-beautify.
@AndalfTheBeard could you confirm if that was your issue as well?
from atom-beautify.
having purged php5, php5-cli and php-pear then reinstalling, along with running
sudo pear install --alldeps php_beautifier-0.1.15
I am still unable to get this to work. which php_beautifier
returns absolutely nothing for me in the terminal however I'm sure that php_beautifier is installed and I can find the file in ~/pear/bin/php_beautifier
setting that to the path just results in this
cmd: "/bin/sh -c [ -f ~/.bash_profile ] && source ~/.bash_profile;[ -f ~/.bash_rc ] && source ~/.bash_rc;php "~/pear/bin/php_beautifier" "/tmp/input114713-3313-1uewpzf" "/tmp/114713-3313-iifrnm""
code: 1
killed: false
message: "Command failed: /bin/sh -c [ -f ~/.bash_profile ] && source ~/.bash_profile;[ -f ~/.bash_rc ] && source ~/.bash_rc;php "~/pear/bin/php_beautifier" "/tmp/input114713-3313-1uewpzf" "/tmp/114713-3313-iifrnm"↵"
signal: null
stack: (...)
get stack: function () { [native code] }
set stack: function () { [native code] }
__proto__: d
I have no idea what is happening here.
trying to use php_beautifier -help
results in the reponse php_beautifier: command not found
even when I'm cded into the same folder as it.
from atom-beautify.
To execute a command, even when in the same directory, you should prefix you command with ./
So it should look like: ./php_beautifier --help
Furthermore, php_beautifier
is a PHP script, which is why I also prefix it with php to force PHP to interpret the script. Your terminal should detect it is a PHP script if the script has the proper headings.
If you can get php_beautifer to work with the above, then we know it is correctly installed.
Instead of using the ~
symbol in the settings path exchange that for the full absolute path, for instance mine is /Users/Glavin/
instead of ~
. Sometimes that causes problems.
Besides that, you generated command from atom beautify looks correct. You should test your source code with php_beautifier
directly via command line and see the result. If that works via command line and does not work via atom beautify, then I have an issue to resolve.
from atom-beautify.
andy@Porrim:~$ cd pear/bin
andy@Porrim:~/pear/bin$ ls
docblockgen pci pear pecl php_beautifier.bat
gen_php_doc.sh pciconf peardev php_beautifier scripts
andy@Porrim:~/pear/bin$ ./php_beautifier -help
PHP Warning: require_once(PHP/Beautifier.php): failed to open stream: No such file or directory in /home/andy/pear/bin/php_beautifier on line 49
PHP Fatal error: require_once(): Failed opening required 'PHP/Beautifier.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/andy/pear/bin/php_beautifier on line 49
andy@Porrim:~/pear/bin$
from atom-beautify.
Not quite sure why you insist on using the long option help
with only a single -
(used for short options). See Command line documentation: http://beautifyphp.sourceforge.net/docs/PHP_Beautifier/tutorial_PHP_Beautifier.howtouse.commandline.pkg.html#command.options
It should be: ./php_beautifier --help
(notice the double -
, so --help
, NOT -help
. If you want to use just one -
then use the short option, -?
). It is failing to parse your incorrect usage and assuming there is instead a file to open, showing error failed to open stream: No such file or directory in
.
from atom-beautify.
-help
--help
and -?
all result in the same error anyway, so that's not at all what's happening.
from atom-beautify.
At least we can now guarantee we are using it as expected.
Sounds like your installation of php_beauifier is broken. This is a php_beautifier issue and you can follow up with them (or do some independent research) and see if they have any experience with this issue.
Once you have php_beautifier working on your machine then we can resume verifying if there are any problems with Atom Beautify.
from atom-beautify.
I am closing this as it appears resolved from an Atom Beautify perspective. Looks like it was a php_beautifier installation issue. / wrong pear path as @BOOMER74 mentioned.
from atom-beautify.
Ok, if you have this problem try this:
- Uninstall PHP_Beautifier
- Type commands and check path:
- pear config-get data_dir
- pear config-get test_dir
- pear config-get doc_dir
- If paths incorrect, set paths:
- pear config-set data_dir C:\php\data
- pear config-set test_dir C:\php\tests
- pear config-set doc_dir C:\php\docs
- Install PHP_Beautifier again with all deps:
- pear install -a channel://pear.php.net/php_beautifier-0.1.15
from atom-beautify.
Can confirm it was a bad install of PHP_Beautifier, not sure how but I managed to fix it. Thanks for the help.
from atom-beautify.
Glad to hear it's working out for everyone. Good to have this discussion available for other Atom Beautify and PHP_Beautifier users. Thanks guys!
from atom-beautify.
Related Issues (20)
- Javascript space before paren HOT 1
- Failed to activate the atom-beautify package HOT 3
- beautify HOT 1
- download failed HOT 1
- Cannot beautify Velocity file HOT 1
- Installed but not listed on packages tab HOT 1
- dart language not support HOT 1
- Could not find 'uncrustify'. The program may not be installed. HOT 1
- 0 I've been trying to install atom-beautify on my Windows 10 x64 machine, but I keep getting this error : npm ERR! code Z_BUF_ERROR npm ERR! errno -5 npm ERR! zlib: unexpected end of file npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\*****\.atom\.apm\_logs\2019-01-18T06_40_37_988Z-debug.log Googling about it, I found this is an issue that has been raised but closed without much in the way of resolution : https://github.com/Glavin001/atom-beautify/issues/2240 I tried uninstalling and reinstalling Atom, and also deleting the .apm folder and giving it another go, and then trying to install previous versions of atom-beautify using the following, apm install [email protected] apm install [email protected] But nothing seems to work, and I get the same error with a Deprecation warning on the latter. Has anyone else encounteredd this issue, are there any known work-arounds for it? HOT 1
- Atom-beautiful
- atom-beautify
- cant go futher of this HOT 1
- network is unreachable
- it was not installing HOT 1
- PHP beautify problem HOT 1
- How can I solve this problem ? HOT 2
- facing error HOT 2
- Not working :( HOT 1
- i
- Object.<anonymous> is deprecated.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-beautify.