php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60698 Explicitly discouraging parethenses for arguments in some language constructs
Submitted: 2012-01-10 10:51 UTC Modified: 2013-10-06 07:33 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: phpmpan at mpan dot pl Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2012-01-10 10:51 UTC] phpmpan at mpan dot pl
Description:
------------
Bug#60694 (and not only it) shows that users too often misinterpret parenthenses around arguments for the following language constructs:
 - echo
 - print
 - include
 - include_once
 - require
 - require_once
Documentation for those things should include warning about the issue (not necessarily the red warning box, a simple sentence should be enough).

Currently there is a notice that multiple arguments for `echo` should not be enclosed in parenthenses and. Also docs for `include` family warn about a case when the return value is used in an expression. However I believe this is insufficient and should be replaced with an explicit warning.

Bug#52722 is related.

Expected result:
----------------
Users should not misinterpret code

Actual result:
--------------
Users misinterpret code, because of parenthenses around arguments

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-06 07:32 UTC] krakjoe@php.net
-Status: Open +Status: Not a bug
 [2013-10-06 07:32 UTC] krakjoe@php.net
Using language constructs expressively is only supported by some language constructs,
 [2013-10-06 07:33 UTC] krakjoe@php.net
sorry about the break in message ...

Those that do support it document sufficiently the use of parenthesis when using the construct expressively.

This is sufficient.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Apr 04 04:01:23 2020 UTC