#23943 [Opn->Bgs]: REGISTER_*_CONSTANT and sizeof to calculate length of constant name
| From: | sniper@php.net | Date: | Mon, 02 Jun 2003 01:37:32 +0000 |
| Subject: | #23943 [Opn->Bgs]: REGISTER_*_CONSTANT and sizeof to calculate length of constant name | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40862@lists.php.net to get a copy of this message | ||
ID: 23943
Updated by: sniper@php.net
Reported By: eddie at omegaware dot com
-Status: Open
+Status: Bogus
-Bug Type: *Compile Issues
+Bug Type: Compile Failure
PHP Version: 4.3.2
New Comment:
Because the macro expects static string. Not bug.
Previous Comments:
------------------------------------------------------------------------
[2003-06-01 18:35:40] eddie at omegaware dot com
fixed the summary field..
------------------------------------------------------------------------
[2003-06-01 18:33:14] eddie at omegaware dot com
Is there any reason why the REGISTER_*_CONSTANT macros (ie
REGISTER_LONG_CONSTANT) use sizeof instead of strlen for calculating
the length of the constant name? I am running into problems which
resort to me having to not use this macros to define functions but to
use the raw zend_register_*_constant function..
example.
using the macro with a literal string for the name works fine.
REGISTER_LONG_CONSTANT("MYCONSTANT",4567,CONST_CS|CONST_PERISISTENT);
however using the macro with a char * variable does not.
char *name = "MYCONSTANT";
REGISTER_LONG_CONSTANT(name,4567,CONST_CS|CONST_PERSISTENT);
The later results with the name_len variable to
zend_register_long_contant being 4, the size of the char *.
This has caused me problems when I was trying to register a char* array
of constants.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23943&edit=1