php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46056 Function returned by function
Submitted: 2008-09-11 15:57 UTC Modified: 2008-09-11 16:08 UTC
From: odakynn at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.0alpha2 OS: Windows XP
Private report: No CVE-ID: None
 [2008-09-11 15:57 UTC] odakynn at gmail dot com
Description:
------------
I was trying to call a function returned by another function and it caused a parse error.

Reproduce code:
---------------
function a() {
    echo 'a';
    return create_function('', 'echo \'b\';');
};
a()();

- OR -

function a() {
    echo 'a';
    return function() { echo 'b'; };
};
a()();

Expected result:
----------------
ab

Actual result:
--------------
Parse error: syntax error, unexpected '(' in ...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-11 16:08 UTC] felipe@php.net
That is expected, func()() cannot be used.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 17:00:02 2025 UTC