Bug #79380 [Opn->Nab]: define() function not working with typecasting

From: Date: Fri, 13 Mar 2020 13:34:30 +0000
Subject: Bug #79380 [Opn->Nab]: define() function not working with typecasting
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226090@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79380&edit=1

 ID:                 79380
 Updated by:         cmb@php.net
 Reported by:        amit000790 at gmail dot com
 Summary:            define() function not working with typecasting
-Status:             Open
+Status:             Not a bug
 Type:               Bug
-Package:            Unknown/Other Function
+Package:            Scripting Engine problem
 Operating System:   Ubuntu 18.04
 PHP Version:        7.4.3
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


Previous Comments:
------------------------------------------------------------------------
[2020-03-13 13:29:43] amit000790 at gmail dot com

Description:
------------
define() function not working with typecasting

For Ex.
define("BLANK_OBJECT", (object) [] );

var_dump( BLANK_OBJECT );

---------------
Output
---------------
Warning: Constants may only evaluate to scalar values, arrays or resources in [...][...] on line 4

Warning: Use of undefined constant BLANK_OBJECT - assumed 'BLANK_OBJECT' (this will throw
an Error in a future version of PHP) in [...][...] on line 6
string(12) "BLANK_OBJECT"

Test script:
---------------
define("BLANK_OBJECT", (object) [] );
var_dump( BLANK_OBJECT );

Expected result:
----------------
stdClass Object
(
)

Actual result:
--------------
Warning: Constants may only evaluate to scalar values, arrays or resources in [...][...] on line 4

Warning: Use of undefined constant BLANK_OBJECT - assumed 'BLANK_OBJECT' (this will throw
an Error in a future version of PHP) in [...][...] on line 6
string(12) "BLANK_OBJECT"


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=79380&edit=1


Thread (2 messages)

« previous php.bugs (#226090) next »