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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
25 - 25 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC