php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67000 @MYCONST evaluates to string "MYCONST"
Submitted: 2014-04-01 13:39 UTC Modified: 2014-04-01 13:42 UTC
From: aleemb at gmail dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.5.10 OS: Ubuntu 12.04
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 !
Your email address:
MUST BE VALID
Solve the problem:
30 - 27 = ?
Subscribe to this entry?

 
 [2014-04-01 13:39 UTC] aleemb at gmail dot com
Description:
------------
The script below illustrates the issue.

Test script:
---------------
<?php
DEFINE('FOO', false);

if (@BAR) {
  echo "this is wrong.";
} else {
  echo "this is correct.";
}


if (@FOO) {
  echo "this is wrong.";
} else {
  echo "this is correct.";
}

var_dump(@BAR);

Expected result:
----------------
this is correct.this is correct.NULL

Actual result:
--------------
this is wrong.this is correct.string(3) "BAR"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-01 13:42 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2014-04-01 13:42 UTC] nikic@php.net
Drop the @ (the error suppression operator) and you'll understand.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 19:01:30 2024 UTC