Re: [PHP-DEV] Could we kill call_user_func?

2013-03-20 Thread Bob Weinand
Am 15.3.2013 um 18:57 schrieb Stas Malyshev : > Hi! > >> why not enable then this "getCallback()();"? > > There's an RFC for that: https://wiki.php.net/rfc/fcallfcall > but it has some edge cases which I didn't have time to figure out yet. Is it possible to add this alternative rule for functio

Re: [PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread Stas Malyshev
Hi! > We've had a problem recently where one of our developers forgot an "if". We clearly have two contradicting directions here. On one hand, we have people that say giving '1' to a method expecting integer should be an error, and anything unexpected should generate warnings and errors because t

Re: [PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread Pierre du Plessis
On 03/20/2013 11:43 AM, Carlos Rodrigues wrote: > Like Mike emaild me, i can just change my code to something like >> $obj->getImage()->getUrl(), where getImage() will return a mock object >> with getUrl() returning an empty string. >> >> But my request here is not about this case only. >> Imagin

AW: [PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread Frank Liepert
> -Ursprüngliche Nachricht- > Von: Carlos Rodrigues [mailto:carlos.v...@gmail.com] > Gesendet: Mittwoch, 20. März 2013 19:08 > An: internals@lists.php.net > Betreff: [PHP-DEV] Method check - Can someone create a RFC for it? > > Hi, > > I'd like to suggest a new functionality for PHP. I do

Re: [PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread Johannes Schlüter
Carlos Rodrigues wrote: >So instead of writing >if ($obj->image) { >echo $obj->image->getUrl(); >} > >He wrote: >echo $obj->image->getUrl(); Make the property private and add a getter which can throw an exception if no image is available ... class C { private $image; public function h

Re: [PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread Matt Pelmear
On 03/20/2013 11:43 AM, Carlos Rodrigues wrote: Like Mike emaild me, i can just change my code to something like $obj->getImage()->getUrl(), where getImage() will return a mock object with getUrl() returning an empty string. But my request here is not about this case only. Imagine you have a web

Re: [PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread Sanford Whiteman
> Create something like $foo->bar?() or $foo->bar()?, where you don't > care whether the function exists, or if $foo is an object. If it > doesn't exist you just return null. [1] Don't do this. [2] What everyone else said. [3] If you feel you must, this at least "colors within the lines" a bit m

Re: [PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread Carlos Rodrigues
Like Mike emaild me, i can just change my code to something like $obj->getImage()->getUrl(), where getImage() will return a mock object with getUrl() returning an empty string. But my request here is not about this case only. Imagine you have a web page with 3 blocks of information. Let's say "new

RE: [PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread nathan
> Hi, > > I'd like to suggest a new functionality for PHP. I don't know the internals, and i can't create a patch implementing this. I'm writing here in case someone likes this idea and write a RFC. > > We've had a problem recently where one of our developers forgot an "if". > > So instead of wr

Re: [PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread Patrick ALLAERT
2013/3/20 Carlos Rodrigues : > Hi, > > I'd like to suggest a new functionality for PHP. I don't know the > internals, and i can't create a patch implementing this. I'm writing > here in case someone likes this idea and write a RFC. > > We've had a problem recently where one of our developers forgot

[PHP-DEV] Method check - Can someone create a RFC for it?

2013-03-20 Thread Carlos Rodrigues
Hi, I'd like to suggest a new functionality for PHP. I don't know the internals, and i can't create a patch implementing this. I'm writing here in case someone likes this idea and write a RFC. We've had a problem recently where one of our developers forgot an "if". So instead of writing if ($obj

RE: [PHP-DEV] E_RECOVERABLE_ERROR for "Call to a member function on a non-object"

2013-03-20 Thread Richard Bradley
> > > > 4. Has anyone attempted this change before and had it rejected, > > > > or given up? > > > 4, yes, at least there were a couple of discussions in general about > > > removing/converting some of the fatals to recoverable fatals > > Thanks: do you have any pointers for where I can fi

Re: [PHP-DEV] E_RECOVERABLE_ERROR for "Call to a member function on a non-object"

2013-03-20 Thread Ferenc Kovacs
> > > 2. Would anyone object to this change? For example on > backwards-compatibility grounds? > > 2, yes > > Could you be more specific? > I was hoping to head off some of the objections in this email thread, or > at least to avoid coding up a patch if it is certain to be rejected. > Could y

RE: [PHP-DEV] E_RECOVERABLE_ERROR for "Call to a member function on a non-object"

2013-03-20 Thread Richard Bradley
> > On Wed, Mar 20, 2013 at 3:37 PM, Richard Bradley > > wrote: > > > > I'd like to patch PHP to make "Call to a member function on a non-object" > > an E_RECOVERABLE_ERROR > > instead of an E_ERROR. > > > 1. Do I need to create an RFC for this change, or could I just create > > a pull r

Re: [PHP-DEV] E_RECOVERABLE_ERROR for "Call to a member function on a non-object"

2013-03-20 Thread Ferenc Kovacs
On Wed, Mar 20, 2013 at 5:14 PM, Ferenc Kovacs wrote: > > > > On Wed, Mar 20, 2013 at 3:37 PM, Richard Bradley < > richard.brad...@softwire.com> wrote: > >> I'd like to patch PHP to make "Call to a member function on a non-object" >> an E_RECOVERABLE_ERROR instead of an E_ERROR. >> >> I have not

Re: [PHP-DEV] E_RECOVERABLE_ERROR for "Call to a member function on a non-object"

2013-03-20 Thread Ferenc Kovacs
On Wed, Mar 20, 2013 at 3:37 PM, Richard Bradley < richard.brad...@softwire.com> wrote: > I'd like to patch PHP to make "Call to a member function on a non-object" > an E_RECOVERABLE_ERROR instead of an E_ERROR. > > I have not been able to find any previous discussion of making this > change, but

[PHP-DEV] E_RECOVERABLE_ERROR for "Call to a member function on a non-object"

2013-03-20 Thread Richard Bradley
I'd like to patch PHP to make "Call to a member function on a non-object" an E_RECOVERABLE_ERROR instead of an E_ERROR. I have not been able to find any previous discussion of making this change, but there are several PHP bugs requesting it: * #51882

[PHP-DEV] Re: [PHP-CVS] com php-src: Backported fix for bug #62852: NEWS ext/date/php_date.c ext/date/tests/bug62852.phpt ext/date/tests/bug62852_var2.phpt ext/date/tests/bug62852_var3.phpt

2013-03-20 Thread Anatol Belski
On Wed, March 20, 2013 09:05, Stas Malyshev wrote: > Hi! > > >> The issue is that a warning wouldn't destroy that object. That object >> will occasionally segfault PHP. E_ERROR is the simplest solution which >> doesn't change the behavior of the normal operations. > > Can't we just reset the object

[PHP-DEV] Re: [PHP-CVS] com php-src: Backported fix for bug #62852: NEWS ext/date/php_date.c ext/date/tests/bug62852.phpt ext/date/tests/bug62852_var2.phpt ext/date/tests/bug62852_var3.phpt

2013-03-20 Thread Pierre Joye
On Wed, Mar 20, 2013 at 8:53 AM, Anatol Belski wrote: > Stas, > > The issue is that a warning wouldn't destroy that object. That object will > occasionally segfault PHP. E_ERROR is the simplest solution which doesn't > change the behavior of the normal operations. > > There is another one bug #534