Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38429 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70269 invoked from network); 19 Jun 2008 19:00:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2008 19:00:57 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:40001] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/A2-57468-8ECAA584 for ; Thu, 19 Jun 2008 15:00:57 -0400 Received: from MBOERGER-ZRH (unknown [193.142.125.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 7BB7611DACA; Thu, 19 Jun 2008 21:00:53 +0200 (CEST) Date: Thu, 19 Jun 2008 21:00:52 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1062092242.20080619210052@marcus-boerger.de> To: "Steph Fox" CC: "internals" In-Reply-To: <04a501c8d181$e67c6ec0$4401a8c0@foxbox> References: <04a501c8d181$e67c6ec0$4401a8c0@foxbox> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [PATCH] unix path separators in spl From: helly@php.net (Marcus Boerger) Hello Steph, how about having this as an option inside the SPL classes that gets turned on by Phar automatically? Inside SPL we could have it as a user set-only flag. marcus Wednesday, June 18, 2008, 10:28:40 PM, you wrote: > Index: ext/spl/spl_directory.c > =================================================================== > RCS file: /repository/php-src/ext/spl/spl_directory.c,v > retrieving revision 1.45.2.27.2.23.2.22 > diff -u -r1.45.2.27.2.23.2.22 spl_directory.c > --- ext/spl/spl_directory.c 18 Jun 2008 10:05:29 -0000 1.45.2.27.2.23.2.22 > +++ ext/spl/spl_directory.c 18 Jun 2008 17:16:39 -0000 > @@ -185,6 +185,9 @@ > intern->file_name_len = > spprintf(&intern->file_name, 0, "%s%c%s", > > spl_filesystem_object_get_path(intern, NULL TSRMLS_CC), > DEFAULT_SLASH, intern->u.dir.entry.d_name); > +#ifdef PHP_WIN32 > + spl_unixify_path_separators(intern->file_name, intern->file_name_len); > +#endif > break; > } > } > @@ -1196,6 +1199,9 @@ > subdir->u.dir.sub_path_len = strlen(intern->u.dir.entry.d_name); > subdir->u.dir.sub_path = > estrndup(intern->u.dir.entry.d_name, subdir->u.dir.sub_path_len); > } > +#ifdef PHP_WIN32 > + spl_unixify_path_separators(intern->u.dir.sub_path, intern->u.dir.sub_path_len); > +#endif > subdir->info_class = intern->info_class; > subdir->file_class = intern->file_class; > subdir->oth = intern->oth; > @@ -1227,6 +1233,9 @@ > > if (intern->u.dir.sub_path) { > len = spprintf(&sub_name, 0, "%s%c%s", > intern->u.dir.sub_path, DEFAULT_SLASH, intern->u.dir.entry.d_name); > +#ifdef PHP_WIN32 > + spl_unixify_path_separators(sub_name, len); > +#endif > RETURN_STRINGL(sub_name, len, 0); > } else { > RETURN_STRING(intern->u.dir.entry.d_name, 1); > Index: ext/spl/spl_directory.h > =================================================================== > RCS file: /repository/php-src/ext/spl/spl_directory.h,v > retrieving revision 1.12.2.5.2.4.2.10 > diff -u -r1.12.2.5.2.4.2.10 spl_directory.h > --- ext/spl/spl_directory.h 20 May 2008 21:46:50 -0000 1.12.2.5.2.4.2.10 > +++ ext/spl/spl_directory.h 18 Jun 2008 17:10:18 -0000 > @@ -112,6 +112,20 @@ > return (spl_filesystem_object*)((char*)it - > XtOffsetOf(spl_filesystem_object, it)); > } > > +#ifdef PHP_WIN32 > +static inline void spl_unixify_path_separators(char *path, int path_len) > +{ > + char *s; > + > + /* unixify win paths */ > + for (s = path; s - path < path_len; ++s) { > + if (*s == '\\') { > + *s = '/'; > + } > + } > +} > +#endif > + > #define SPL_FILE_OBJECT_DROP_NEW_LINE 0x00000001 /* drop new lines */ > #define SPL_FILE_OBJECT_READ_AHEAD 0x00000002 /* read on rewind/next */ > #define SPL_FILE_OBJECT_SKIP_EMPTY 0x00000006 /* skip empty lines */ Best regards, Marcus