ID: 28102
User updated by: dv at josheli dot com
Reported By: dv at josheli dot com
Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: Windows
PHP Version: Irrelevant
New Comment:
what about the original bug report? it's a documentation error or just
a magic feature?
Previous Comments:
------------------------------------------------------------------------
[2004-04-25 20:51:09] [EMAIL PROTECTED]
1. It prints "AA" because PHP will convert an undefined constant to a
string. (and throws a warning "Notice: Use of undefined constant AA -
assumed 'AA'")
2. Constants are supposed to be scalar only.
No bug here Nuno.
------------------------------------------------------------------------
[2004-04-25 20:29:44] [EMAIL PROTECTED]
Maybe there an engine error here. Take a look at this code:
<?
$tidy = new tidy;
define('aa', $tidy);
print_r(AA);
?>
outputs:
Warning: Constants may only evaluate to scalar values in
C:\cygwin\home\Nuno\constants.php on line 3
Call Stack:
0.0012 1. {main}() C:\cygwin\home\Nuno\constants.php:0
0.0014 2. define('aa', class tidy { public $errorBuffer = NULL;
public $va
lue = NULL }) C:\cygwin\home\Nuno\constants.php:3
Notice: Use of undefined constant AA - assumed 'AA' in
C:\cygwin\home\Nuno\constants.php on line 4
Call Stack:
0.0012 1. {main}() C:\cygwin\home\Nuno\constants.php:0
Variables in local scope:
$tidy = class tidy { public $errorBuffer = NULL; public $value = NULL
}
AA
1) It seems that in fact this works, but outputs a couple of errors and
echoes the name of the constant, too. Need a fix in the engine.
2) constants are suposed to scalar data or they may have
objects/resources?
------------------------------------------------------------------------
[2004-04-22 08:28:47] dv at josheli dot com
Description:
------------
http://www.php.net/manual/en/language.constants.php
"Only scalar data (boolean, integer, float and string) can be contained
in constants."
http://www.php.net/manual/en/function.mysql-connect.php
"resource mysql_connect ( ... )"
According to the documentation, "Expected result" is an E_NOTICE error
or something, but I guess the "Actual result" below implies that a
mysql link "resource" is actually an integer (4?). perhaps the
documentation in either of the two places listed above, or in the
define() man page, should reflect this fact?
Reproduce code:
---------------
$dbLink = mysql_connect($dbServerName, $dbUser, $dbPassword);
define('DB_LINK',$dbLink);
var_dump(DB_LINK);
echo gettype(DB_LINK);
Expected result:
----------------
see above.
Actual result:
--------------
resource(4) of type (mysql link)
resource
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28102&edit=1