2

How is it possible to see notices about undefined variables in the problem window of Aptana?

I want to write clean source code and the hint for PHP notice is important for me, at first in the IDE and less in the running application as it's already "too late".

Maybe Aptana has an option to activate this to see the PHP notices, not only error and warnings?

See my screenshot, maybe its easier to understand my question. On this screen I will see PHP notices, warnings and errors. enter image description here

A example of code, that create a PHP notice in webapp, in browser:

<?php

echo $undefined_var;

The var is not defined and result in this notice message:

Notice: Undefined variable: undefined_var in /var/www/wp-plugins/my-test.php on line 3

Charles
  • 50,943
  • 13
  • 104
  • 142
bueltge
  • 2,294
  • 1
  • 29
  • 40
  • Maybe there is something in the aptana documentation/manual? – KingCrunch Dec 31 '12 at 12:55
  • I have search for this, also via Google, no results :( – bueltge Dec 31 '12 at 12:57
  • Okay, you want to have PHP errors / notices in the Problems view, so you are missing them, right? – hakre Dec 31 '12 at 13:02
  • @Hakre: yes, I will see the notice in the IDE, not only in the browser. The php errors are a icon on the line, include the description and was list in the problem window, but not the notices. – bueltge Dec 31 '12 at 13:05
  • Can you provide some (short) example code that gives such a notice? I think this will improve your question and make more clear what you're looking for. I also edited your question a bit, I hope it's better that way. – hakre Dec 31 '12 at 13:06
  • Yes, the easiest way for a php notice was now as example in my question. – bueltge Dec 31 '12 at 13:27

2 Answers2

2

AFAIK Aptana (and also other Eclipse PHP editor plugins like PDT) do not report Undefined Variable warning / notices for the Problems view.

PHP itself gives this notice only, when the code is executed. So an IDE must also somewhat "execute" the code or do a more high-level static code analysis to report these kind of problems.

An IDE I know of that does this is Phpstorm, which is very good with the static code analysis part.

hakre
  • 193,403
  • 52
  • 435
  • 836
  • Hi Hakre, thanks for this cleared words. PHPstorm is so much long on my test list, but current I dont find enough time to test, not worl for customer. But this also a new point for switch and check the IDE. – bueltge Dec 31 '12 at 14:06
  • @bueltge: Yes, you should try it out. I've been using Eclipse in the past and still use it for some jobs, but PHP development incl. Wordpress fiddling (as I know you do that, too), I use Phpstorm nowadays. It's a hell of a great PHP IDE IMHO and you should not wait any longer trying it out. It's also very reasonable priced and right now you can take the EAP version and later on the 30 day trial when it comes out - if you want some extended testing period. – hakre Dec 31 '12 at 14:14
  • Thanks for this hints, only the UI was the current problem for me and also the habit makes hard to change. – bueltge Jan 01 '13 at 15:31
1

I don't think it's possible to report undefined variables in Problems view, but in latest Aptana releases you can configure a debugger (I tried XDebug) and then run it.

enter image description here

mutil
  • 3,205
  • 1
  • 27
  • 34
  • Thanks for this hint. Maybe you have a link for howto to set debugging in Aptana? I have checked this before a long time, but not with usefull results. Thanks – bueltge Jan 01 '13 at 15:30
  • 1
    Have a look [at this thread](http://stackoverflow.com/questions/6860814/xdebug-with-aptana-studio-3/) – mutil Jan 01 '13 at 19:10