#50101 [NEW]: [PATCH] - Avoid name clash between global and local variable

From: Date: Fri, 06 Nov 2009 12:41:17 +0000
Subject: #50101 [NEW]: [PATCH] - Avoid name clash between global and local variable
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-144313@lists.php.net to get a copy of this message
From: yoarvi at gmail dot com Operating system: Solaris 5.10 (SPARC) PHP version: 6SVN-2009-11-06 (SVN) PHP Bug Type: *Compile Issues Bug description: [PATCH] - Avoid name clash between global and local variable Description: ------------ TSRM/tsrm_virtual_cwd.c uses the same name for a global variable as well as for arguments to a function (when #ifndef ZTS). #ifdef ZTS ts_rsrc_id cwd_globals_id; #else virtual_cwd_globals cwd_globals; #endif static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC) /* {{{ */ static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC) /* {{{ */ Reproduce code: --------------- The following patch avoids the name clash: diff -r f2728a22d214 TSRM/tsrm_virtual_cwd.c --- a/TSRM/tsrm_virtual_cwd.c Fri Nov 06 18:07:39 2009 +0530 +++ b/TSRM/tsrm_virtual_cwd.c Fri Nov 06 18:13:55 2009 +0530 @@ -262,19 +262,19 @@ } /* }}} */ -static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC) /* {{{ */ +static void cwd_globals_ctor(virtual_cwd_globals *cwdg TSRMLS_DC) /* {{{ */ { - CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state); - cwd_globals->realpath_cache_size = 0; - cwd_globals->realpath_cache_size_limit = REALPATH_CACHE_SIZE; - cwd_globals->realpath_cache_ttl = REALPATH_CACHE_TTL; - memset(cwd_globals->realpath_cache, 0, sizeof(cwd_globals->realpath_cache)); + CWD_STATE_COPY(&cwdg->cwd, &main_cwd_state); + cwdg->realpath_cache_size = 0; + cwdg->realpath_cache_size_limit = REALPATH_CACHE_SIZE; + cwdg->realpath_cache_ttl = REALPATH_CACHE_TTL; + memset(cwdg->realpath_cache, 0, sizeof(cwdg->realpath_cache)); } /* }}} */ -static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC) /* {{{ */ +static void cwd_globals_dtor(virtual_cwd_globals *cwdg TSRMLS_DC) /* {{{ */ { - CWD_STATE_FREE(&cwd_globals->cwd); + CWD_STATE_FREE(&cwdg->cwd); realpath_cache_clean(TSRMLS_C); } /* }}} */ Expected result: ---------------- Disambiguity. -- Edit bug report at http://bugs.php.net/?id=50101&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50101&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50101&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50101&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50101&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50101&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50101&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50101&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50101&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50101&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50101&r=support Expected behavior: http://bugs.php.net/fix.php?id=50101&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50101&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50101&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50101&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50101&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50101&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50101&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50101&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50101&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50101&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50101&r=mysqlcfg

« previous php.bugs (#144313) next »