Skip to content

Commit c6529b2

Browse files
committed
Warning instead of TypeError for current silent issues
1 parent c173f83 commit c6529b2

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

ext/zip/php_zip.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -350,39 +350,35 @@ static bool php_zip_parse_options(HashTable *options, zip_options *opts)
350350

351351
if ((option = zend_hash_str_find(options, "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) {
352352
if (Z_TYPE_P(option) != IS_FALSE && Z_TYPE_P(option) != IS_TRUE) {
353-
zend_type_error("Option \"remove_all_path\" must be of type bool, %s given",
353+
php_error_docref(NULL, E_WARNING, "Option \"remove_all_path\" must be of type bool, %s given",
354354
zend_zval_type_name(option));
355-
return false;
356355
}
357-
opts->remove_all_path = Z_LVAL_P(option);
356+
opts->remove_all_path = zval_get_long(option);
358357
}
359358

360359
if ((option = zend_hash_str_find(options, "comp_method", sizeof("comp_method") - 1)) != NULL) {
361360
if (Z_TYPE_P(option) != IS_LONG) {
362-
zend_type_error("Option \"comp_method\" must be of type int, %s given",
361+
php_error_docref(NULL, E_WARNING, "Option \"comp_method\" must be of type int, %s given",
363362
zend_zval_type_name(option));
364-
return false;
365363
}
366-
opts->comp_method = Z_LVAL_P(option);
364+
opts->comp_method = zval_get_long(option);
367365

368366
if ((option = zend_hash_str_find(options, "comp_flags", sizeof("comp_flags") - 1)) != NULL) {
369367
if (Z_TYPE_P(option) != IS_LONG) {
370-
zend_type_error("Option \"comp_flags\" must be of type int, %s given",
368+
php_error_docref(NULL, E_WARNING, "Option \"comp_flags\" must be of type int, %s given",
371369
zend_zval_type_name(option));
372-
return false;
373370
}
374-
opts->comp_flags = Z_LVAL_P(option);
371+
opts->comp_flags = zval_get_long(option);
375372
}
376373
}
377374

378375
#ifdef HAVE_ENCRYPTION
379376
if ((option = zend_hash_str_find(options, "enc_method", sizeof("enc_method") - 1)) != NULL) {
380377
if (Z_TYPE_P(option) != IS_LONG) {
381-
zend_type_error("Option \"enc_method\" must be of type int, %s given",
378+
php_error_docref(NULL, E_WARNING, "Option \"enc_method\" must be of type int, %s given",
382379
zend_zval_type_name(option));
383-
return false;
384380
}
385-
opts->enc_method = Z_LVAL_P(option);
381+
opts->enc_method = zval_get_long(option);
386382

387383
if ((option = zend_hash_str_find(options, "enc_password", sizeof("enc_password") - 1)) != NULL) {
388384
if (Z_TYPE_P(option) != IS_STRING) {

0 commit comments

Comments
 (0)