#47751 [Opn->Csd]: define() allows resources as values
| From: | kalle@php.net | Date: | Mon, 23 Mar 2009 11:20:21 +0000 |
| Subject: | #47751 [Opn->Csd]: define() allows resources as values | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2027@lists.php.net to get a copy of this message | ||
ID: 47751
Updated by: kalle@php.net
Reported By: mgkimsal at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: any
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Seems like I forgot to add that to the define page while I updated the
constants.syntax page.
But yes, resource constants are allowed but it was decided to leave the
implementation as it is now for BC.
Previous Comments:
------------------------------------------------------------------------
[2009-03-23 00:31:47] mgkimsal at gmail dot com
Description:
------------
This is a duplicate of http://bugs.php.net/bug.php?id=29534 which is
4.5 years old now. The comment 3 years ago was that the XML docs had
been updated, but the current PHP doc page for define still shows that
"only scalar and null values are allowed. Scalar values are integer,
float, string or boolean values." This is still wrong. Either the docs
need to be updated to indicate resources are allowed, or PHP needs to be
updated to throw an error when a resource is define()d.
Reproduce code:
---------------
---
From manual page: function.define
---
<?php
$f = fopen(__FILE__,"r");
define('x',$f);
fclose($f);
$g = fread(x,400);
echo $g;
echo x;
echo constant('x');
Expected result:
----------------
some sort of error
Actual result:
--------------
the program prints out itself (because I'm read the fopen of __FILE__)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47751&edit=1