summaryrefslogtreecommitdiff
path: root/ext/phar/phar.c
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2009-04-30 04:43:10 +0000
committerGreg Beaver <cellog@php.net>2009-04-30 04:43:10 +0000
commit6289c323d37f33bfd79437a887e47b2101669e7c (patch)
tree3da4ab8729818f2c018e5675476fcd95137edae1 /ext/phar/phar.c
parent1bca3a1dc1b9dba73c4cffbbe67e400981848516 (diff)
downloadphp-git-6289c323d37f33bfd79437a887e47b2101669e7c.tar.gz
MFPECL fix PECL Bug #14646: phar error message unclear with php stream wrappers (note: is there a standard way to list PECL bugs in NEWS?)
Diffstat (limited to 'ext/phar/phar.c')
-rw-r--r--ext/phar/phar.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 1035cc294a..df3d0997d7 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -1262,7 +1262,11 @@ int phar_open_or_create_filename(char *fname, int fname_len, char *alias, int al
/* next try to create a new file */
if (FAILURE == phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, !is_data, 1, 1 TSRMLS_CC)) {
if (error) {
- spprintf(error, 0, "Cannot create phar '%s', file extension (or combination) not recognised", fname);
+ if (ext_len == -2) {
+ spprintf(error, 0, "Cannot create a phar archive from a URL like \"%s\". Phar objects can only be created from local files", fname);
+ } else {
+ spprintf(error, 0, "Cannot create phar '%s', file extension (or combination) not recognised", fname);
+ }
}
return FAILURE;
}
@@ -1903,6 +1907,12 @@ int phar_detect_phar_fname_ext(const char *filename, int filename_len, const cha
pos = memchr(filename, '/', filename_len);
if (pos && pos != filename) {
+ /* check for url like http:// or phar:// */
+ if (*(pos - 1) == ':' && (pos - filename) < filename_len - 1 && *(pos + 1) == '/') {
+ *ext_len = -2;
+ *ext_str = NULL;
+ return FAILURE;
+ }
if (zend_hash_exists(&(PHAR_GLOBALS->phar_alias_map), (char *) filename, pos - filename)) {
*ext_str = pos;
*ext_len = -1;