php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64326 Parse error on casting a bracket array to an object
Submitted: 2013-02-28 16:11 UTC Modified: 2013-10-15 11:54 UTC
From: f at worldhomes dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.4.12 OS: Mac
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: f at worldhomes dot com
New email:
PHP Version: OS:

 

 [2013-02-28 16:11 UTC] f at worldhomes dot com
Description:
------------
This code does not work on Mac OSX Lion :

json_encode ( (object) [ 'status' => (int) $newstatus ] )

After further debugging, problem: "(object)[]" : you can not cast a bracket array 
to object
Parse error: unexpected '['

Test script:
---------------
json_encode ( (object) [ 'status' => 4 ] )


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-28 17:00 UTC] reeze@php.net
There is no such error, see: http://3v4l.org/Qjk0T 
PHP >= 5.4 works fine.

Are you sure you are running 5.4.12?
 [2013-02-28 17:00 UTC] reeze@php.net
-Status: Open +Status: Feedback
 [2013-10-15 11:54 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 "Re-Opened". Thank you.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Mar 15 10:01:29 2025 UTC