php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #46608 Return() Not Documented Correctly
Submitted: 2008-11-18 22:52 UTC Modified: 2009-11-23 21:17 UTC
From: php at info-svc dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
 [2008-11-18 22:52 UTC] php at info-svc dot com
Description:
------------
I'm reporting a documentation comment that was rejected but should be
valid.

"Note that since return() is a language construct and not a function, the parentheses surrounding its arguments are not required."

Far from optional, the parentheses actually cause an error when used as described in the documentation regarding include/require.

Reproduce code:
---------------
test1.php
<?php require 'test2.php'; ?>

test2.php
<?php return(); ?>

Actual result:
--------------
PHP Parse error:  syntax error, unexpected ')' in test2.php on line 1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-22 14:40 UTC] lbarnaud@php.net
?
 [2008-12-21 09:21 UTC] php at info-svc dot com
tag: Robert Chapin
 [2009-11-23 21:17 UTC] bjori@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

The manual does say that:
"Note:  If no parameter is supplied, then the parentheses must be omitted and NULL will be returned. Calling return() with parentheses but with no arguments will result in a parse error.  "
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 00:00:02 2026 UTC