if (eval) {
zval v;
+ zend_string *eval_str;
/* null terminate buffer */
smart_str_0(&eval_buf);
+
+ if (eval_buf.s) {
+ eval_str = eval_buf.s;
+ } else {
+ eval_str = ZSTR_EMPTY_ALLOC();
+ }
+
/* do eval */
- if (zend_eval_stringl(ZSTR_VAL(eval_buf.s), ZSTR_LEN(eval_buf.s), &v, description) == FAILURE) {
+ if (zend_eval_stringl(ZSTR_VAL(eval_str), ZSTR_LEN(eval_str), &v, description) == FAILURE) {
efree(description);
- zend_throw_error(zend_ce_error, "Failed evaluating code: %s%s", PHP_EOL, ZSTR_VAL(eval_buf.s));
- onig_region_free(regs, 0);
- smart_str_free(&out_buf);
- smart_str_free(&eval_buf);
- RETURN_FALSE;
- php_error_docref(NULL,E_ERROR, "Failed evaluating code: %s%s", PHP_EOL, ZSTR_VAL(eval_str));
++ zend_throw_error(NULL, "Failed evaluating code: %s%s", PHP_EOL, ZSTR_VAL(eval_str));
+ /* zend_error() does not return in this case */
}
/* result of eval */
#define GET_REFLECTION_OBJECT() \
intern = Z_REFLECTION_P(getThis()); \
- if (intern == NULL || intern->ptr == NULL) { \
+ if (intern->ptr == NULL) { \
RETURN_ON_EXCEPTION \
- php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the reflection object"); \
+ zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the reflection object"); \
+ return; \
} \
#define GET_REFLECTION_OBJECT_PTR(target) \
case IS_OBJECT:
if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr)) {
argument = Z_REFLECTION_P(class_name);
- if (argument == NULL || argument->ptr == NULL) {
+ if (argument->ptr == NULL) {
- php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
- /* Bails out */
+ zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the argument's reflection object");
+ return;
}
class_ce = argument->ptr;
break;
case IS_OBJECT:
if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr)) {
argument = Z_REFLECTION_P(interface);
- if (argument == NULL || argument->ptr == NULL) {
+ if (argument->ptr == NULL) {
- php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
- /* Bails out */
+ zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the argument's reflection object");
+ return;
}
interface_ce = argument->ptr;
break;
return;
}
if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) {
- php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name));
+ zend_throw_error(zend_ce_error, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name));
/* Bails out */
}
- ZVAL_DUP(return_value, &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]);
+ member_p = &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset];
+ ZVAL_DEREF(member_p);
+ ZVAL_COPY(return_value, member_p);
} else {
const char *class_name, *prop_name;
size_t prop_name_len;
}
/* If there is no ID, use session module to create one */
- if (!PS(id)) {
+ if (!PS(id) || !ZSTR_VAL(PS(id))[0]) {
+ if (PS(id)) {
+ zend_string_release(PS(id));
+ }
PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
if (!PS(id)) {
- php_error_docref(NULL, E_ERROR, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ php_session_abort();
+ zend_throw_error(zend_ce_error, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
return;
}
if (PS(use_cookies)) {