#47751 [NEW]: define() allows resources as values
| From: | mgkimsal at gmail dot com | Date: | Mon, 23 Mar 2009 00:31:48 +0000 |
| Subject: | #47751 [NEW]: define() allows resources as values | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-2026@lists.php.net to get a copy of this message | ||
From: mgkimsal at gmail dot com
Operating system: any
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: define() allows resources as values
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 bug report at http://bugs.php.net/?id=47751&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47751&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47751&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47751&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47751&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47751&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47751&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47751&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47751&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47751&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47751&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47751&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47751&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47751&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47751&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47751&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47751&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47751&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47751&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47751&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47751&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47751&r=mysqlcfg