If UG(unicode) is on, ZVAL_ASCII_STRING() will convert binary string
arg to Unicode and return it as IS_UNICODE, otherwise it will return
string as-is (IS_STRING). In the former case, the string is assumed
to contain only ASCII chars.
What are you after exactly?
-Andrei
On Dec 20, 2006, at 3:30 PM, Marcus Boerger wrote:
helly Wed Dec 20 23:30:23 2006 UTC
Modified files:
/php-src/ext/spl spl_directory.c
Log:
- Quick hackto make tests pass
# There is something missing, ZVAL_TYPED_ASCII_STRING(z, type,
char*,flags)
# Or am i overseeinghow that works?
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_directory.c?
r1=1.105&r2=1.106&diff_format=u
Index: php-src/ext/spl/spl_directory.c
diff -u php-src/ext/spl/spl_directory.c:1.105 php-src/ext/spl/
spl_directory.c:1.106
--- php-src/ext/spl/spl_directory.c:1.105 Sun Nov 12 17:56:14 2006
+++ php-src/ext/spl/spl_directory.c Wed Dec 20 23:30:23 2006
@@ -16,7 +16,7 @@
+---------------------------------------------------------------------
-+
*/
-/* $Id: spl_directory.c,v 1.105 2006/11/12 17:56:14 helly Exp $ */
+/* $Id: spl_directory.c,v 1.106 2006/12/20 23:30:23 helly Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1225,16 +1225,28 @@
{
spl_filesystem_object *intern = (spl_filesystem_object*)
zend_object_store_get_object(readobj TSRMLS_CC);
- if (type == IS_STRING) {
- switch (intern->type) {
- case SPL_FS_INFO:
- case SPL_FS_FILE:
+ switch (intern->type) {
+ case SPL_FS_INFO:
+ case SPL_FS_FILE:
+ if (type == IS_STRING) {
ZVAL_STRINGL(writeobj, intern->file_name, intern-
>file_name_len, 1);
return SUCCESS;
- case SPL_FS_DIR:
+ }
+ if (type == IS_UNICODE && UG(unicode)) {
+ ZVAL_ASCII_STRINGL(writeobj, intern->file_name, intern-
>file_name_len, 1);
+ return SUCCESS;
+ }
+ break;
+ case SPL_FS_DIR:
+ if (type == IS_STRING) {
ZVAL_STRING(writeobj, intern->u.dir.entry.d_name, 1);
return SUCCESS;
}
+ if (type == IS_UNICODE && UG(unicode)) {
+ ZVAL_ASCII_STRING(writeobj, intern->u.dir.entry.d_name,
1);
+ return SUCCESS;
+ }
+ break;
}
ZVAL_NULL(writeobj);
return FAILURE;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php