Doc #80230 [NEW]: Doc for exec specifies & (reference) param, fails

From: Date: Tue, 13 Oct 2020 19:45:20 +0000
Subject: Doc #80230 [NEW]: Doc for exec specifies & (reference) param, fails
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17993@lists.php.net to get a copy of this message
From:             per at perit dot se
Operating system: Linux
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:Doc for exec specifies & (reference) param, fails

Description:
------------
---
From manual page: https://php.net/function.exec
---
The documentation specifies syntax
exec ( string $command [, array &$output [, int &$return_var ]] ) :
string

This syntax breaks PHP, and according to numerous internet articles like
https://stackoverflow.com/questions/8971261/php-5-4-call-time-pass-by-reference-easy-fix-available
explaining it has been so a while:
> As of PHP 5.3.0, you will get a warning saying that "call-time
pass-by-reference" is deprecated when you use & in foo(&$a);.

Please update the documentation with correct syntax, and if/when it
differs for specific versions, please note the version and change in
question - now it incorrectly claims to be valid for "(PHP 4, PHP 5, PHP
7)"



Test script:
---------------
$ cat > test-ref-arg.php
<?php
  exec ( "pwd", &$output );  
  echo "Got output: ";
  var_dump($output);

$ php test-ref-arg.php
PHP Fatal error:  Call-time pass-by-reference has been removed in
/home/xx/IMPORT/test-ref-arg on line 2

/opt/rh/rh-php73/root/bin/php test-ref-arg.php
PHP Parse error:  syntax error, unexpected '&', expecting ')' in
/home/xx/test-ref-arg.php on line 2



-- 
Edit bug report at https://bugs.php.net/bug.php?id=80230&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80230&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80230&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80230&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80230&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80230&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80230&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80230&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80230&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80230&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80230&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80230&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80230&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80230&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80230&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80230&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80230&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80230&r=mysqlcfg


Thread (5 messages)

« previous php.doc.bugs (#17993) next »