diff --git a/NEWS b/NEWS index baf838481682c..a2ce7e7ad2d1e 100644 --- a/NEWS +++ b/NEWS @@ -71,6 +71,7 @@ PHP NEWS - Enchant: . Added enchant_dict_remove_from_session(). (nielsdos) . Added enchant_dict_remove(). (nielsdos) + . Fix missing empty string checks. (nielsdos) - EXIF: . Add OffsetTime* Exif tags. (acc987) diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 95d9a44f80dd7..617e114dd05db 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5962,16 +5962,16 @@ ZEND_VM_HANDLER(68, ZEND_NEW, UNUSED|CLASS_FETCH|CONST|VAR, UNUSED|CACHE_SLOT, N constructor = Z_OBJ_HT_P(result)->get_constructor(Z_OBJ_P(result)); if (constructor == NULL) { - if (UNEXPECTED(EG(exception))) { - HANDLE_EXCEPTION(); - } - /* If there are no arguments, skip over the DO_FCALL opcode. We check if the next * opcode is DO_FCALL in case EXT instructions are used. */ if (EXPECTED(opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL)) { ZEND_VM_NEXT_OPCODE_EX(1, 2); } + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } + /* Perform a dummy function call */ call = zend_vm_stack_push_call_frame( ZEND_CALL_FUNCTION, (zend_function *) &zend_pass_function, diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index aa1c8e7e175eb..791e4b4e88437 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -11046,16 +11046,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_CONST_UNUSED_HANDLER( constructor = Z_OBJ_HT_P(result)->get_constructor(Z_OBJ_P(result)); if (constructor == NULL) { - if (UNEXPECTED(EG(exception))) { - HANDLE_EXCEPTION(); - } - /* If there are no arguments, skip over the DO_FCALL opcode. We check if the next * opcode is DO_FCALL in case EXT instructions are used. */ if (EXPECTED(opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL)) { ZEND_VM_NEXT_OPCODE_EX(1, 2); } + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } + /* Perform a dummy function call */ call = zend_vm_stack_push_call_frame( ZEND_CALL_FUNCTION, (zend_function *) &zend_pass_function, @@ -30594,16 +30594,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_VAR_UNUSED_HANDLER(ZE constructor = Z_OBJ_HT_P(result)->get_constructor(Z_OBJ_P(result)); if (constructor == NULL) { - if (UNEXPECTED(EG(exception))) { - HANDLE_EXCEPTION(); - } - /* If there are no arguments, skip over the DO_FCALL opcode. We check if the next * opcode is DO_FCALL in case EXT instructions are used. */ if (EXPECTED(opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL)) { ZEND_VM_NEXT_OPCODE_EX(1, 2); } + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } + /* Perform a dummy function call */ call = zend_vm_stack_push_call_frame( ZEND_CALL_FUNCTION, (zend_function *) &zend_pass_function, @@ -38059,16 +38059,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_UNUSED_UNUSED_HANDLER constructor = Z_OBJ_HT_P(result)->get_constructor(Z_OBJ_P(result)); if (constructor == NULL) { - if (UNEXPECTED(EG(exception))) { - HANDLE_EXCEPTION(); - } - /* If there are no arguments, skip over the DO_FCALL opcode. We check if the next * opcode is DO_FCALL in case EXT instructions are used. */ if (EXPECTED(opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL)) { ZEND_VM_NEXT_OPCODE_EX(1, 2); } + if (UNEXPECTED(EG(exception))) { + HANDLE_EXCEPTION(); + } + /* Perform a dummy function call */ call = zend_vm_stack_push_call_frame( ZEND_CALL_FUNCTION, (zend_function *) &zend_pass_function, diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index d1d9ee60c440a..eedb49b69e8f9 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -529,6 +529,11 @@ PHP_FUNCTION(enchant_broker_dict_exists) PHP_ENCHANT_GET_BROKER; + if (taglen == 0) { + zend_argument_must_not_be_empty_error(2); + RETURN_THROWS(); + } + RETURN_BOOL(enchant_broker_dict_exists(pbroker->pbroker, tag)); } /* }}} */ @@ -554,6 +559,16 @@ PHP_FUNCTION(enchant_broker_set_ordering) PHP_ENCHANT_GET_BROKER; + if (ptaglen == 0) { + zend_argument_must_not_be_empty_error(2); + RETURN_THROWS(); + } + + if (porderinglen == 0) { + zend_argument_must_not_be_empty_error(3); + RETURN_THROWS(); + } + enchant_broker_set_ordering(pbroker->pbroker, ptag, pordering); RETURN_TRUE; } diff --git a/ext/enchant/tests/broker_dict_exists_empty.phpt b/ext/enchant/tests/broker_dict_exists_empty.phpt new file mode 100644 index 0000000000000..ce4a2ae436251 --- /dev/null +++ b/ext/enchant/tests/broker_dict_exists_empty.phpt @@ -0,0 +1,17 @@ +--TEST-- +enchant_broker_dict_exists() function - empty tag +--EXTENSIONS-- +enchant +--FILE-- +getMessage(), "\n"; +} +echo "Done\n"; +?> +--EXPECT-- +enchant_broker_dict_exists(): Argument #2 ($tag) must not be empty +Done diff --git a/ext/enchant/tests/broker_set_ordering_empty.phpt b/ext/enchant/tests/broker_set_ordering_empty.phpt new file mode 100644 index 0000000000000..f0df14dd74d67 --- /dev/null +++ b/ext/enchant/tests/broker_set_ordering_empty.phpt @@ -0,0 +1,23 @@ +--TEST-- +enchant_broker_set_ordering() function - empty tag +--EXTENSIONS-- +enchant +--FILE-- +getMessage(), "\n"; +} +try { + enchant_broker_set_ordering($broker, '*', ''); +} catch (ValueError $e) { + echo $e->getMessage(), "\n"; +} +echo "Done\n"; +?> +--EXPECT-- +enchant_broker_set_ordering(): Argument #2 ($tag) must not be empty +enchant_broker_set_ordering(): Argument #3 ($ordering) must not be empty +Done