Edit report at https://bugs.php.net/bug.php?id=64053&edit=1

 ID:                 64053
 Updated by:         [email protected]
 Reported by:        gasol dot wu at gmail dot com
 Summary:            It's possible to change constant value in C
                     extension.
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   MacOS X 10.8/FreeBSD 9.1
 PHP Version:        5.4.11
 Block user comment: N
 Private report:     N

 New Comment:

PHP extensions can do many things. What you are doing is changing engine-owned 
memory. Anything might happen. Make sure to either separate the zval of the 
parameter or copy the string before modifying it.


Previous Comments:
------------------------------------------------------------------------
[2013-01-23 06:05:36] gasol dot wu at gmail dot com

Description:
------------
I have encounter this problem couple weeks ago, So I write some tests to see 
different result between PHP 5.3 and PHP 5.4 (even in 5.4.11).

https://github.com/Gasol/const_test

Testing Result:

5.4.11
=====================================================================
PHP         : /Users/gasol/.phpbrew/php/php-5.4.11/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 5.4.11
ZEND_VERSION: 2.4.0
PHP_OS      : Darwin - Darwin gasol-mbp 12.2.0 Darwin Kernel Version 12.2.0: 
Sat 
Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
INI actual  : /Users/gasol/Code/const_test/tmp-php.ini
More .INIs  :  
CWD         : /Users/gasol/Code/const_test
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2013-01-23 05:52:33
=====================================================================
PASS Check for const_test presence [tests/001-load.phpt] 
FAIL Check for modify custom constant [tests/002-modify_const.phpt] 
PASS Check for modify constant declared in class [tests/003-
modify_class_const.phpt] 
FAIL Check for modify system constant [tests/004-modify_system_const.phpt] 
=====================================================================
TIME END 2013-01-23 05:52:33

PHP 5.3.21
=====================================================================
PHP         : /Users/gasol/.phpbrew/php/php-5.3.21/bin/php 
PHP_SAPI    : cli
PHP_VERSION : 5.3.21
ZEND_VERSION: 2.3.0
PHP_OS      : Darwin - Darwin gasol-mbp 12.2.0 Darwin Kernel Version 12.2.0: 
Sat 
Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
INI actual  : /Users/gasol/Code/const_test/tmp-php.ini
More .INIs  :  
CWD         : /Users/gasol/Code/const_test
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2013-01-23 06:03:06
=====================================================================
PASS Check for const_test presence [tests/001-load.phpt] 
PASS Check for modify custom constant [tests/002-modify_const.phpt] 
PASS Check for modify constant declared in class [tests/003-
modify_class_const.phpt] 
PASS Check for modify system constant [tests/004-modify_system_const.phpt] 
=====================================================================
TIME END 2013-01-23 06:03:06



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64053&edit=1

Reply via email to