Req #70278 [Com]: Allow null to be passed by reference
| From: | spam2 at rhsoft dot net | Date: | Tue, 12 Mar 2019 17:30:12 +0000 |
| Subject: | Req #70278 [Com]: Allow null to be passed by reference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219932@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70278&edit=1
ID: 70278
Comment by: spam2 at rhsoft dot net
Reported by: cyslider at posteo dot de
Summary: Allow null to be passed by reference
Status: Open
Type: Feature/Change Request
Package: *General Issues
PHP Version: Next Major Version
Block user comment: N
Private report: N
New Comment:
> I can not omit this parameter as I have to pass the parameter coming after it
than complain about that https://wiki.php.net/rfc/named_params still
don't work in PHP as it did in VB6 20 years ago
> I also have no problem getting a warning free solution by using.
> $null=null;
> exec($script, $null, $result);
hell write $null=''; and file a bugreprot at your IDE which is clearly wrong
Previous Comments:
------------------------------------------------------------------------
[2019-03-12 16:48:22] cyslider at posteo dot de
I am really sorry if I did rub you the wrong way, I did not intend to do so.
I can not omit this parameter as I have to pass the parameter coming after it.
I also have no problem getting a warning free solution by using.
$null=null;
exec($script, $null, $result);
I prefer this over just
exec($script, $null, $result);
as I don't want to use an uninitialized variable this way and would not be surprised if a
future PHP version will issue some kind of warning for this.
I merely find it an odd choice to not accept a direct null here and wanted to bring this to the
developers attention, that there exists at least one user of their product that would consider this
an improvement. But if I am the only one, this certainly is not worth your time and you should just
close this as WON'T FIX.
Thank you, for hearing me out.
------------------------------------------------------------------------
[2019-03-12 15:59:49] spam2 at rhsoft dot net
it is a BY-REFERENCE param so what do you think means a default of NULL?
omit errors, do nothing at all and no it would not be better allow function(null) as call because
you technically can't pass anything else then variables as reference
just don't specify that optional param at all if you don't make use of it, don't call
the variable $null because it is wrong and to satisfy your buggy IDE write $output = ''
instead null and you are done - hell, it's a REFERENCE and so it don't matter what value
it has to satisfy your IDE because after the call it has the output of the called function
------------------------------------------------------------------------
[2019-03-12 15:37:49] cyslider at posteo dot de
That is what my IDE shows me. Also a bug?
function exec ($command, array &$output = null, &$return_var = null) {}
I understand 'array &$output = null' as having null by default. Sorry if this is not
meant that way internally. I am not aware of that. I thought this notation always refers to setting
a default value in case the value is omitted.
------------------------------------------------------------------------
[2019-03-12 14:49:03] cmb@php.net
The default value of the $output parameter of exec() is not NULL;
actually, this parameter has no default value. Either the
argument is omitted, or not.
Anyhow, this feature request is obviously controversial, so it
should be discussed on <internals@lists.php.net>, and might need
the RFC process[1].
[1] <https://wiki.php.net/rfc/howto>
------------------------------------------------------------------------
[2019-03-12 13:48:39] cyslider at posteo dot de
All I am saying is that having to pass null by reference to a function that explicitly states to
accept null as a value, even as its default, is odd.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=70278
--
Edit this bug report at https://bugs.php.net/bug.php?id=70278&edit=1