Doc #76411 [NEW]: Should state that function arguments are passed by reference if objects

From: Date: Sun, 03 Jun 2018 18:56:29 +0000
Subject: Doc #76411 [NEW]: Should state that function arguments are passed by reference if objects
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15733@lists.php.net to get a copy of this message
From:             teo8976 at gmail dot com
Operating system: 
PHP version:      Irrelevant
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:Should state that function arguments are passed by reference if  objects

Description:
------------
---
From manual page: http://www.php.net/functions.arguments
---

Where it says:
"""
By default, function arguments are passed by value (so that if the value
of the argument within the function is changed, it does not get changed
outside of the function).
"""

it should say that an exception to this are objects, which are passed by
reference.


For comparison, the documentation for the assignment operator does
specify that:

http://docs.php.net/manual/en/language.operators.assignment.php
"""
Note that the assignment copies the original variable to the new one
(assignment by value), [...]
An exception to the usual assignment by value behaviour within PHP
occurs with objects, which are assigned by reference
"""

So, the documentation for function arguments should be equally clear and
explicit.


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



Thread (6 messages)

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