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

 ID:               50101
 Updated by:       tony2...@php.net
 Reported by:      yoarvi at gmail dot com
 Summary:          [PATCH] - Avoid name clash between global and local
                   variable
-Status:           Open
+Status:           Closed
 Type:             Bug
 Package:          Compile Failure
 Operating System: Solaris 5.10 (SPARC)
 PHP Version:      6SVN-2009-11-06 (SVN)
-Assigned To:      
+Assigned To:      tony2001

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2010-06-08 15:27:31] tony2...@php.net

Automatic comment from SVN on behalf of tony2001
Revision: http://svn.php.net/viewvc/?view=revision&revision=300276
Log: fix bug #50101 (name clash between global and local variable)

------------------------------------------------------------------------
[2009-11-06 12:41:17] yoarvi at gmail dot com

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 this bug report at http://bugs.php.net/bug.php?id=50101&edit=1

Reply via email to