diff options
| author | Greg Beaver <cellog@php.net> | 2007-11-13 05:57:14 +0000 |
|---|---|---|
| committer | Greg Beaver <cellog@php.net> | 2007-11-13 05:57:14 +0000 |
| commit | 999961f080c7456f88b34fb70969e7bc6f6b247f (patch) | |
| tree | 1a61674e35369d1d4139e0fa774137e1f8697bf0 /ext | |
| parent | 36e52c89b12fe5777cbdd656e049b9cde96d8fa1 (diff) | |
| download | php-git-999961f080c7456f88b34fb70969e7bc6f6b247f.tar.gz | |
begin win32 fixes for Phar object - still have a problem I can't track down yet, but it's only a matter of time before it is killed too
when passing in a full path with drive letter to the Phar object, we were
then passing "phar://C:/path/to/blah.phar" to php_parse_url(), which
thinks it is getting a valid url scheme "phar", host "C" path "/path/to/blah.phar"
we now pass "phar:///C:/path/to/blah.phar" to make it fail, and then properly
parse the url inside phar
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/phar/phar.c | 7 | ||||
| -rwxr-xr-x | ext/phar/phar_object.c | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 521bd69bde..386d11449b 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1482,6 +1482,13 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le filename_len -= 7; } +#ifdef PHP_WIN32 + if (filename_len > 3 && *filename == '/' && *(filename + 2) == ':' && *(filename + 3) == '/') { + filename++; + filename_len--; + } +#endif + if (phar_detect_phar_fname_ext(filename, 0, &ext_str, &ext_len) == FAILURE) { return FAILURE; } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 64b3a77f1c..684fd128d3 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -244,7 +244,16 @@ PHP_METHOD(Phar, __construct) phar_obj->arc.archive = phar_data; phar_obj->spl.oth_handler = &phar_spl_foreign_handler; +#ifdef PHP_WIN32 + /* check for drive filenames like C:/ and prepend / */ + if (fname_len > 2 && *(fname + 1) == ':' && *(fname + 2) == '/') { + fname_len = spprintf(&fname, 0, "phar:///%s", fname); + } else { + fname_len = spprintf(&fname, 0, "phar://%s", fname); + } +#else fname_len = spprintf(&fname, 0, "phar://%s", fname); +#endif INIT_PZVAL(&arg1); ZVAL_STRINGL(&arg1, fname, fname_len, 0); |
