mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
- MFH
- Make internal code forward-compatible. This included a binary cast in the default stub, hence test updates.
This commit is contained in:
parent
b3b5126954
commit
6a0682d986
18 changed files with 129 additions and 85 deletions
|
@ -778,7 +778,7 @@ PHP_METHOD(Phar, webPhar)
|
|||
mime.len = Z_STRLEN_PP(val); \
|
||||
} \
|
||||
mime.type = ret; \
|
||||
zend_hash_update(&mimetypes, key, keylen-1, (void *)&mime, sizeof(phar_mime_type), NULL);
|
||||
zend_hash_update(&mimetypes, str_key, keylen-1, (void *)&mime, sizeof(phar_mime_type), NULL);
|
||||
|
||||
if (mimeoverride) {
|
||||
if (!zend_hash_num_elements(Z_ARRVAL_P(mimeoverride))) {
|
||||
|
@ -786,9 +786,11 @@ PHP_METHOD(Phar, webPhar)
|
|||
}
|
||||
for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(mimeoverride)); SUCCESS == zend_hash_has_more_elements(Z_ARRVAL_P(mimeoverride)); zend_hash_move_forward(Z_ARRVAL_P(mimeoverride))) {
|
||||
zval **val;
|
||||
char *key;
|
||||
phar_zstr key;
|
||||
char *str_key;
|
||||
uint keylen;
|
||||
ulong intkey;
|
||||
|
||||
if (HASH_KEY_IS_LONG == zend_hash_get_current_key_ex(Z_ARRVAL_P(mimeoverride), &key, &keylen, &intkey, 0, NULL)) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Key of MIME type overrides array must be a file extension, was \"%d\"", intkey);
|
||||
phar_entry_delref(phar TSRMLS_CC);
|
||||
|
@ -797,8 +799,11 @@ PHP_METHOD(Phar, webPhar)
|
|||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHAR_STR(key, str_key);
|
||||
|
||||
if (FAILURE == zend_hash_get_current_data(Z_ARRVAL_P(mimeoverride), (void **) &val)) {
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Failed to retrieve Mime type for extension \"%s\"", key);
|
||||
zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, "Failed to retrieve Mime type for extension \"%s\"", str_key);
|
||||
phar_entry_delref(phar TSRMLS_CC);
|
||||
#ifdef PHP_WIN32
|
||||
efree(fname);
|
||||
|
@ -1114,11 +1119,8 @@ PHP_METHOD(Phar, __construct)
|
|||
return;
|
||||
}
|
||||
|
||||
#if PHP_VERSION_ID >= 60000
|
||||
objname = phar_obj->std.ce->name.s;
|
||||
#else
|
||||
objname = phar_obj->std.ce->name;
|
||||
#endif
|
||||
PHAR_STR(phar_obj->std.ce->name, objname);
|
||||
|
||||
if (!strncmp(objname, "PharData", 8)) {
|
||||
is_data = 1;
|
||||
} else {
|
||||
|
@ -1315,7 +1317,9 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
|
|||
phar_entry_data *data;
|
||||
php_stream *fp;
|
||||
long contents_len;
|
||||
char *fname, *error, *str_key, *base = p_obj->b, *opened, *save = NULL, *temp = NULL;
|
||||
char *fname, *error, *base = p_obj->b, *opened, *save = NULL, *temp = NULL;
|
||||
phar_zstr key;
|
||||
char *str_key;
|
||||
zend_class_entry *ce = p_obj->c;
|
||||
phar_archive_object *phar_obj = p_obj->p;
|
||||
char *str = "[stream]";
|
||||
|
@ -1339,10 +1343,14 @@ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{
|
|||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
if (iter->funcs->get_current_key) {
|
||||
key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC);
|
||||
key_type = iter->funcs->get_current_key(iter, &key, &str_key_len, &int_key TSRMLS_CC);
|
||||
|
||||
if (EG(exception)) {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
|
||||
PHAR_STR(key, str_key);
|
||||
|
||||
if (key_type == HASH_KEY_IS_LONG) {
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name);
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
|
@ -1438,10 +1446,14 @@ phar_spl_fileinfo:
|
|||
}
|
||||
} else {
|
||||
if (iter->funcs->get_current_key) {
|
||||
key_type = iter->funcs->get_current_key(iter, &str_key, &str_key_len, &int_key TSRMLS_CC);
|
||||
key_type = iter->funcs->get_current_key(iter, &key, &str_key_len, &int_key TSRMLS_CC);
|
||||
|
||||
if (EG(exception)) {
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
}
|
||||
|
||||
PHAR_STR(key, str_key);
|
||||
|
||||
if (key_type == HASH_KEY_IS_LONG) {
|
||||
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, "Iterator %s returned an invalid key (must return a string)", ce->name);
|
||||
return ZEND_HASH_APPLY_STOP;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue