php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60410 script stops when closure used without open brackets
Submitted: 2011-11-29 14:15 UTC Modified: 2013-02-18 00:35 UTC
From: zarzu dot razvan at gmail dot com Assigned:
Status: No Feedback Package: Variables related
PHP Version: Irrelevant OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zarzu dot razvan at gmail dot com
New email:
PHP Version: OS:

 

 [2011-11-29 14:15 UTC] zarzu dot razvan at gmail dot com
Description:
------------
When declaring a closure and using it without the open brackets (as if it were a variable), PHP stops from executing next instructions.

Test script:
---------------
$a = function(){};
echo $a;
echo 'Hey!';

Expected result:
----------------
Hey!

Actual result:
--------------
nothing

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-29 14:20 UTC] felipe@php.net
Check if your display_errors is set to 0 (zero)
 [2011-11-29 15:49 UTC] zarzu dot razvan at gmail dot com
display_errors was set to 1. Changed it to 0, same result.
 [2011-11-30 00:27 UTC] yohgaki@php.net
That's strange. With cli/Linux, I get this for both trunk and PHP 5.3

PHP Catchable fatal error:  Object of class Closure could not be converted to 
string in /home/yohgaki/ext/svn/oss/php.net/php-src/t3.php on line 3

Try with cli binary.
 [2011-11-30 00:28 UTC] yohgaki@php.net
-Status: Open +Status: Feedback
 [2013-02-18 00:35 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 13:03:41 2021 UTC