Re: [PHP-DEV] Re:[PHP-DEV] [VOTE] Allow a trailing comma in function calls

2017-10-21 Thread Kalle Sommer Nielsen
Hi CHU Zhaowei

2017-10-22 7:24 GMT+02:00 CHU Zhaowei :
> Hello Sammy,
>
>
> I'd like to know if a trailing comma would affect the number of args or not. 
> for example,
> ```
> function foo(){
>   return func_num_args();
>
> }
> foo('a','b',);
> ```
> would return 2 or 3?

With the current patch submitted for this RFC, your example will
return 2, as it will simply ignore the trailing comma at the end of
your call. You can see the more detailed test at github here[1].


[1] 
https://github.com/SammyK/php-src/compare/master...rfc-trailing-comma-function-calls#diff-88d4f8d1ae810e0722bf59cf1a739228

-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Re:[PHP-DEV] [VOTE] Allow a trailing comma in function calls

2017-10-21 Thread CHU Zhaowei
Hello Sammy,


I'd like to know if a trailing comma would affect the number of args or not. 
for example,
```
function foo(){
  return func_num_args();

}
foo('a','b',);
```
would return 2 or 3?


best regards,
CHU Zhaowei

 
-- Original --
From:  "Sammy Kaye Powers";
Date:  Sun, Oct 22, 2017 02:36 AM
To:  "PHP Internals"; 

Subject:  [PHP-DEV] [VOTE] Allow a trailing comma in function calls

 
Hi internalsland!

Seeing that the mandatory two-week discussion period has completed and
there are no open questions, the RFC to allow a trailing comma in
function calls in PHP 7.3 is up for vote.

https://wiki.php.net/rfc/trailing-comma-function-calls

As this is a change to the language syntax, the RFC requires a 2/3
majority to pass. The voting period will last two weeks beginning now
(2017-10-21 18:30 UTC) and ending 2017-11-04 18:30 UTC.

Happy Halloween! :)

Thanks,
Sammy Kaye Powers
sammyk.me

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] [VOTE] Allow a trailing comma in function calls

2017-10-21 Thread Sammy Kaye Powers
Hi internalsland!

Seeing that the mandatory two-week discussion period has completed and
there are no open questions, the RFC to allow a trailing comma in
function calls in PHP 7.3 is up for vote.

https://wiki.php.net/rfc/trailing-comma-function-calls

As this is a change to the language syntax, the RFC requires a 2/3
majority to pass. The voting period will last two weeks beginning now
(2017-10-21 18:30 UTC) and ending 2017-11-04 18:30 UTC.

Happy Halloween! :)

Thanks,
Sammy Kaye Powers
sammyk.me

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: Wouldn't Exception::getContext() be useful?

2017-10-21 Thread Michael Morris
Just for debugging. I've been mulling over how to improve exception/error
handling in Drupal 8 out of the box.

On Sat, Oct 21, 2017 at 10:31 AM, Rowan Collins 
wrote:

> On 21 October 2017 11:41:46 BST, "Christoph M. Becker" 
> wrote:
> >On 21.10.2017 at 09:20, Michael Morris wrote:
> >
> >> Right now the only way I know of to see the context of an exception
> >throw
> >> is to pass it in..
> >>
> >> throw new CustomException(get_definted_vars());
> >>
> >> It would be very useful to have exceptions just have this as a
> >method.
> >> set_error_handle had this ability, but it's now deprecated.  I'm
> >guessing
> >> there's an engine reason why this hasn't happened because it seems
> >like a
> >> pretty obvious include to the default methods of the Exception and
> >Error
> >> objects.
> >
> >Quite likely the same reasoning as for deprecating the $errcontext
> >argument applies, see
> > errcontext_argument_of_error_handler>.
>
>
> See also my posts about the problems of capturing arguments in the
> exception's backtrace (sorry, don't have an archive link to hand).
> Basically, holding references to objects without user interaction makes
> object lifetimes unpredictable and serialization unexpectedly fail.
>
> Did you just want this for debugging, or was there some other use case?
>
> Regards,
>
> --
> Rowan Collins
> [IMSoP]
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DEV] Re: Wouldn't Exception::getContext() be useful?

2017-10-21 Thread Rowan Collins
On 21 October 2017 11:41:46 BST, "Christoph M. Becker"  
wrote:
>On 21.10.2017 at 09:20, Michael Morris wrote:
>
>> Right now the only way I know of to see the context of an exception
>throw
>> is to pass it in..
>> 
>> throw new CustomException(get_definted_vars());
>> 
>> It would be very useful to have exceptions just have this as a
>method.
>> set_error_handle had this ability, but it's now deprecated.  I'm
>guessing
>> there's an engine reason why this hasn't happened because it seems
>like a
>> pretty obvious include to the default methods of the Exception and
>Error
>> objects.
>
>Quite likely the same reasoning as for deprecating the $errcontext
>argument applies, see
>.


See also my posts about the problems of capturing arguments in the exception's 
backtrace (sorry, don't have an archive link to hand). Basically, holding 
references to objects without user interaction makes object lifetimes 
unpredictable and serialization unexpectedly fail.

Did you just want this for debugging, or was there some other use case?

Regards,

-- 
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Re: Wouldn't Exception::getContext() be useful?

2017-10-21 Thread Christoph M. Becker
On 21.10.2017 at 09:20, Michael Morris wrote:

> Right now the only way I know of to see the context of an exception throw
> is to pass it in..
> 
> throw new CustomException(get_definted_vars());
> 
> It would be very useful to have exceptions just have this as a method.
> set_error_handle had this ability, but it's now deprecated.  I'm guessing
> there's an engine reason why this hasn't happened because it seems like a
> pretty obvious include to the default methods of the Exception and Error
> objects.

Quite likely the same reasoning as for deprecating the $errcontext
argument applies, see
.

-- 
Christoph M. Becker

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Wouldn't Exception::getContext() be useful?

2017-10-21 Thread Michael Morris
Right now the only way I know of to see the context of an exception throw
is to pass it in..

throw new CustomException(get_definted_vars());

It would be very useful to have exceptions just have this as a method.
set_error_handle had this ability, but it's now deprecated.  I'm guessing
there's an engine reason why this hasn't happened because it seems like a
pretty obvious include to the default methods of the Exception and Error
objects.