Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-12 Thread Stas Malyshev
Hi! It seems that there are no consensus about this feature so... *if in doubt, leave it out.* I don't see any serious objections to it except comments from people that seem not really understand what this feature is about and complain about bad code which has nothing to do with the actual

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-12 Thread Gustavo Lopes
Em Tue, 12 Apr 2011 10:04:36 +0100, Stas Malyshev smalys...@sugarcrm.com escreveu: It seems that there are no consensus about this feature so... *if in doubt, leave it out.* I don't see any serious objections to it except comments from people that seem not really understand what this

RE: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-12 Thread Mike Robinson
On Mon, Apr 11, 2011 at 4:09 PM Chris Stockton wrote: My suggestion to use ?? I will say has little to do with laziness. I would be happy with any solution that solves my problem, I just know that implementing a patch for ?? would be simple enough (I could even do so if requested). Everyone

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-12 Thread Richard Quadling
Considering that the main impetus for these threads is to write code that does not generate the notice regarding missing variables or indices, neither isset() or empty() will provide that completely. If a variable is declared, but assigned null, it is not set and it is empty. But so what. The

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-12 Thread Richard Quadling
On 12 April 2011 12:33, Richard Quadling rquadl...@gmail.com wrote: [1] http://pastebin.com/qLNYtfAw Updated to http://pastebin.com/cqSEcGpN to include 0 and '' values. The output is ... Undefined variableisset() = false empty() = true defined = false Defined variable null

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-12 Thread Lars Schultz
Am 12.04.2011 13:33, schrieb Richard Quadling: Notice: Undefined variable Notice: Undefined index To me, these two notices are totally different in severity, but that may be because of how i write my code. I'd like to be able to get rid of the Undefined index Notice in a nice, clean,

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Hannes Landeholm
@ is not convenient since it turns off error reporting for all errors. I don't know how many times I've silenced a notice and got a blank page in my face as a thank you for accidentally silencing that fatal error too. Silent is reserved for the purpose of the silence operator though @ so using

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Ben Schmidt
I think another problem with using @ is that it is done by the caller, not the callee, so it doesn't allow functions like issetor() to be implemented in userland without expecting every caller to do pass the variable while silencing errors. I also don't think the inconvenience is restricted to

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Ben Schmidt
If doing the suppression of undefined notices be better if the ? was put after the opening square bracket, thereby removing the ambiguity (which I think would be more troublesome than you think)? $array[?foo] I suppose a non-array-specific version would be to put it after the $. $?variable

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Etienne Kneuss
On Apr 10 21:22:58, D. Dante Lorenso wrote: The problem with implementing ifsetor, filled, or ?? in userland is that the not set or undefined warning is fired before the variable is passed to the underlying function/method. Is it possible to add a modifier that turns off warnings for

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Michael Morris
I might come off rather crumudgeonly here, but these last few threads I've seen going across to silence notices have a common theme - I wanna be a lazier coder. Which is fine - set the PHP error level to not show them. But don't ask the engine to be rewritten to encourage bad coding practices

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Pascal COURTOIS
Le 11/04/2011 19:17, Michael Morris a écrit : But don't ask the engine to be rewritten to encourage bad coding practices which failing to properly initialize variables is a prime example of. It's this sort of thinking that got register_globals and magic_quotes put into the language no doubt.

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Stas Malyshev
Hi! I might come off rather crumudgeonly here, but these last few threads I've seen going across to silence notices have a common theme - I wanna be a lazier coder. Laziness is a virtue for a coder :) At least, when it goes to avoid unnecessary work - in this example, boilerplate code.

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Matthew Weier O'Phinney
On 2011-04-11, Stas Malyshev smalys...@sugarcrm.com wrote: I might come off rather crumudgeonly here, but these last few threads I've seen going across to silence notices have a common theme - I wanna be a lazier coder. Laziness is a virtue for a coder :) At least, when it goes to avoid

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Chris Stockton
Hello, On Mon, Apr 11, 2011 at 11:47 AM, Matthew Weier O'Phinney weierophin...@php.net wrote: On 2011-04-11, Stas Malyshev smalys...@sugarcrm.com wrote: I might come off rather crumudgeonly here, but these last few threads I've seen going across to silence notices have a common theme - I

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-11 Thread Martin Scotta
It seems that there are no consensus about this feature so... *if in doubt, leave it out.* Martin Scotta On Mon, Apr 11, 2011 at 5:09 PM, Chris Stockton chrisstockto...@gmail.comwrote: Hello, On Mon, Apr 11, 2011 at 11:47 AM, Matthew Weier O'Phinney weierophin...@php.net wrote: On

[PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-10 Thread D. Dante Lorenso
The problem with implementing ifsetor, filled, or ?? in userland is that the not set or undefined warning is fired before the variable is passed to the underlying function/method. Is it possible to add a modifier that turns off warnings for undefined variables whenever that specific method is

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-10 Thread Matt Wilson
@. On Apr 10, 2011, at 9:22 PM, D. Dante Lorenso wrote: The problem with implementing ifsetor, filled, or ?? in userland is that the not set or undefined warning is fired before the variable is passed to the underlying function/method. Is it possible to add a modifier that turns off

Re: [PHP-DEV] proposed access modifier silent ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator

2011-04-10 Thread Stas Malyshev
Hi! @. Note however it does not exactly turn off the warning, only changes it to not reported. It's still generated and can be picked up by handlers, for example. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP