I have done some research but have not found something that fits my scenario exactly. I am using Dreamweaver CS5 with PHP files and Dreamweaver alerts me that there is an error in my code with this line:
if(explode("_","some_variable")[0]=="some"){
If I remove the brackets [ ] then the error message goes away making the line be
if(explode("_","some_variable")=="some"){ //never true obviously
I know that I could assign the exploded array to a variable and then call the first value of that variable to remove this code but I was trying to find a solution to be able to write a little more shorthand code.
I found that this method of calling an index is supported from PHP version 5.4 from the answer here: https://stackoverflow.com/a/19408331/1707323 but Dreamweaver still throws error alert. I was able to find out that Dreamweaver CS5 supports code hinting and syntax for PHP version 5.2.
So the main question is: How can I add more support to Dreamweaver CS5 code hinting and syntax checker OR is there a way to ignore certain syntax errors while preserving the rest of the syntax checker?
I know that I could change the line to
if($string = explode("_",$key) && $string[0]=="understand"){
Or I could write a custom function such as the referred answer above suggests, but why write extra code just to satisfy an outdated syntax checker when there might be a way to update the syntax checker.
Note: I am not looking for any answers that involves updating to a newer version of Dreamweaver such as CS5.5 or CS6 as I already have CS5 and do not want to dish out money just for this reason.
The short answer is you can't extend code syntax for CS5. Adobe doesn't support older versions of Dreamweaver and there will not be a patch for it. They want you to upgrade to the latest (subscription-based) version instead.
in dreamweaver cc 2015, your code still alert in the info bar as an error.
dreamweaver use a PHP_KnowledgeEngine.dll (in it's configration folder), it seems this engine is using some source code fron zend engine, but it still cannot correcttly handle this situation.
Related
Has anyone configured VS Code to show syntax/semantic errors in PHP development? Coming from full Visual Studio/C# world, I really miss this thing a lot. Currently I actually have to call my PHP function using a client, only to get a HTTP 500 error and then check server logs to see what went wrong. This is a huge pain. Going through all of this only to find for example that I didn't import a require namespace, is so frustrating.
I understand that PHP by design cannot detect all kinds of errors like C# at compile time (so to speak), but detecting functions that do not exist or not passing required parameters should be easy to catch.
Is there a plug-in or setting in VS Code that could handle syntax/semantic error in PHP code? I'm using Laravel on the server-side, if that matters.
Looks like I found something. I uninstalled PHP Intellisense extension this morning and installed PHP Intelephense and all seems to be far better. Not only that the syntax and semantic errors are highlighted, it automatically injects required namespaces too. And if that were not enough, Go To Definition (F12) command has started working correctly all of a suden. :)
Must-have extension for any PHP work in VSCode I'd say.
I'm testing pug-php (with laravel-pug) for use in a future project.
I'm using PHP expression syntax (I prefer it to JS expression syntax), but Pug plugin for PhpStorm is only for JS Syntax.
Can I configure PhpStorm for use PHP syntax and recognize PHP function like strtoupper($str).
This capture show errors and warnings marked by the IDE, but it code compile fine.
There is no support for pug-php in PhpStorm at the moment. We also did not receive any requests for this so it would be great if you could submit the feature request to our tracking system here: http://youtrack.jetbrains.com/issues/WI#newissue=yes.
You will be able to receive the answer directly from our developers while other users will be able to write their opinion of your proposal.
I'm looking for a php syntax checker, preferably as an eclipse plugin, preferably be able to sort of compile it(at least find undefined variables in addition to syntax checking. Does such thing exist?
Every better IDE (PhpStorm, Eclipse/PDT, Eclipse/PHPEclipse, Netbeans with PHP-Plugin, and so on) comes with automatic syntax check built-in. At least PhpStorm is able to find undefined variables. The last time I used PDT it didn't support it. PHPEclipse seems to be not maintained anymore, so I assume, that it cannot find undefined variables too, and netbeans ... don't know.
If you just want to check the syntax the quick&dirty way, you can use the php-interpreter itself
php -l filename.php
Of course, look on this:
http://www.eclipse.org/pdt/
This IDE using php parser engine to syntax, and is for free :-).
But, better do not use the plugin version from update site, but All-In-One Package. At least previous versions from update site did not work too well...
Install phpEclipse for syntax-checking:
http://www.phpeclipse.com/
In PHP there is no such thing as an undefined variable. Variables are automatically initialized with null.
Zend Studio (custom Eclipse) also has a syntax checker, FWIW.
Our PHP Formatter parses PHP code to an AST, and then prettyprints the results. This can be used as a command-line script. If the source file isn't parsable, the tool exits with with an error (and doesn't prettyprint). So, if you ignore the prettyprint feature, this is precisely a command-line level syntax checker. Easy to launch from Eclipse.
Dreamweaver has been my favourite IDE for programming PHP for a while.
However we have recently updated our servers to work with php 5.3.x
Now everytime I use php 5.3 specific tags like namespace dreamweaver suggests that there is a syntax error.
I would like to be able to add the namespace as a valid tag or install a plugin which does that for me. If that can't be done it would be best if I could just disable the checking for errors.
Can anyone help me out?
Thanks in advance!
Dreamweaver CS5 PHP support is limited to PHP 5.2 (based on a couple of Google searches), and the syntax checker is not extensible, so no extension would be able to make that go away. I've seen in a couple of places that you can turn off the error checking by turning off the PHP related code hints (Edit [Dreamweaver on Mac] -> Preferences -> Code Hints), but I've not tried that. Of course, if that works, then you'll get no code hints for variables and functions defined in your code, so not sure that will be a good trade off. On the other hand, Dreamweaver does report that code hinting may not work until syntax errors are corrected.
Dreamweaver CS5.5 Dynamic Code HInting PHP support is updated to PHP 5.3
Im trying to compile phpurple. Im doing everything according to the documentation:
hxxp://phurple.php.belsky.info/ch02.html
but "make" gives me an error:
/myhomedir/phpurple/purple.c: In function ‘call_custom_method’:
/myhomedir/phpurple/purple.c:1370: error: ‘zend_fcall_info’ has no member named ‘object_pp’
/myhomedir/phpurple/purple.c:1408: error: ‘zend_fcall_info_cache’ has no member named ‘object_pp’
I`ve found other people with the same problem:
hxxp://www.mail-archive.com/monetdb-bugs#lists.sourceforge.net/msg05515.html
hxxp://belsky.info/archives/23-Phurple-per-se-PHPurple.html
but nobody gives any information about successful php 5.3 build and the message
PROJECT IS CLOSED if you want
commercial support for php 5.3, let me
know ... )
does not help at all.
does anyone have any idea how to compile it or any clue how to fix the problem ?
P.S. Sorry about the links, some strange StackOverflow limitation
According to phpurple requirements:
Please let me know, if you've successfully compiled on
earlier versions. Actually the extension is being developed
on the php v5.2.6 with the option to be upcomming php v5.3
compatible.
The authors will need to update their source. However, since you have the source you could update it yourself because you noted that the project is CLOSED. You could also fork the code and create your own gitHub project with php 5.3 support.
Good luck.
What you are seeing is PHP's shifty interface (ahem, hold your down votes, I said s h i f t y). By that, I mean function prototypes are subject to change from version to version. Take this meta example:
int foo_call_bar(const char *foobar, size_t len);
And in a later version of something, the function calculates the length dynamically, thus eliminating the second variable in the prototype:
int foo_call_bar(const char *foobar);
Some projects strive to always maintain backwards compatibility to alleviate this headache, which could be accomplished with pre-processor directives that prototype the new implementation with the len variable, but just don't do anything with it. If PHP did that, the code base would succumb to even more madness.
Unfortunately, you'll have to modify phpurple to present the correct arguments to the correct PHP functions, and ensure that they are of the appropriate type. That would be a bit of an undertaking, but probably wouldn't be as difficult as it seems.
The Linux kernel's VFS interface is the same way, and I'm often tasked with porting older experimental file systems to work on modern kernels.
look at that man
http://sourceforge.net/news/?group_id=235197&id=296063
A little late, but here is the latest library that works with PHP 5.3:
The new project page is: http://sourceforge.net/projects/phurple
The blog post: http://belski.net/archives/23-Phurple-per-se-PHPurple.html
I have ran into a problem after I have complied it and added the extension to PHP.ini configuration:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/phurple.so' - /usr/lib/php/modules/phurple.so: undefined symbol: ZVAL_ADDREF in Unknown on line 0
To fix this, change the line containing ZVAL_ADDREF in client.c from
ZVAL_ADDREF(PHURPLE_G(phurple_client_obj));
to
Z_ADDREF_P(PHURPLE_G(phurple_client_obj));
Well, the new URL seems to be a persistent repo with fixes to PHP-5.3 and above. Maybe that should be mentioned, but that won't help with checking it out anyway. For me it worked fine, so I would say it is worth a try.
You can check the new sources shortly posted on https://github.com/weltling/phurple