Hi guys,

First of all, don't laugh! =D

The idea and patch are extremely simple.
Based on recent experiments with Namespaces and FQCN thing I spoke
with Johannes a couple of days ago, I decided to dive into source and
try a possible patch.
That's my first attempt to contribution to internals. Mainly I try to
help on PHP side.

The idea is to create a new global constant NS_SEPARATOR to be used. I
know constants are used to represent internal values or values that
differ between different OS's, but the main idea here is to prevent
possible issues from user land and also to help people that do not
have "\" key in their keyboard (like finnish keyboards).
Here is a clear usage of this new constant:
http://www.php.net/manual/en/language.namespaces.dynamic.php#91552

I don't really know if the file is the right one to have this
constant, but it works for me perfectly.


Index: Zend/zend_constants.c
===================================================================
RCS file: /repository/ZendEngine2/zend_constants.c,v
retrieving revision 1.71.2.5.2.7.2.17
diff -u -r1.71.2.5.2.7.2.17 zend_constants.c
--- Zend/zend_constants.c       12 Jan 2009 21:54:37 -0000
1.71.2.5.2.7.2.17
+++ Zend/zend_constants.c       18 Jun 2009 15:29:52 -0000
 -151,6 +151,13 @@
                c.value.type = IS_BOOL;
                zend_register_constant(&c TSRMLS_CC);
        }
+
+       /* Namespace separator constant */
+       static char nssep_str[2];
+       nssep_str[0] = '\\';
+       nssep_str[1] = '\0';
+
+       REGISTER_MAIN_STRING_CONSTANT("NS_SEPARATOR", nssep_str,
CONST_PERSISTENT | CONST_CS);
 }



Cheers,

-- 
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9215-8480
MSN: guilhermebla...@hotmail.com
URL: http://blog.bisna.com
São Paulo - SP/Brazil

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to