php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64053 It's possible to change constant value in C extension.
Submitted: 2013-01-23 06:05 UTC Modified: 2013-01-23 11:50 UTC
From: gasol dot wu at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.4.11 OS: MacOS X 10.8/FreeBSD 9.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gasol dot wu at gmail dot com
New email:
PHP Version: OS:

 

 [2013-01-23 06:05 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-23 11:50 UTC] johannes@php.net
-Status: Open +Status: Not a bug
 [2013-01-23 11:50 UTC] johannes@php.net
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.
 [2013-01-23 18:06 UTC] gasol dot wu at gmail dot com
I understand PHP extensions can do many things, But why does PHP 5.3 and PHP 5.4 
have inconsistent result ?
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Dec 16 11:00:01 2025 UTC