OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
-#include "php_psi_stdinc.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# include "php_config.h"
+#endif
+
#include "context.h"
#include "data.h"
#include "call.h"
+#include "php_psi.h"
+
#include "php.h"
#include "zend_exceptions.h"
}
size_t psi_call_frame_num_var_args(struct psi_call_frame *frame) {
- return zend_hash_next_free_element(&frame->arguments);
+ zend_long nfe = zend_hash_next_free_element(&frame->arguments);
+ return nfe > 0 ? nfe : 0;
}
size_t psi_call_frame_num_fixed_args(struct psi_call_frame *frame) {
#else
# define PARAM_PROLOGUE(separate) Z_PARAM_PROLOGUE(1, separate)
#endif
-ZEND_RESULT_CODE psi_call_frame_parse_args(struct psi_call_frame *frame,
+bool psi_call_frame_parse_args(struct psi_call_frame *frame,
zend_execute_data *execute_data) {
size_t i, argc = psi_plist_count(frame->impl->func->args);
zend_error_handling zeh;
rv = zend_parse_parameters_none();
zend_restore_error_handling(&zeh);
- return rv;
+ return rv == SUCCESS;
}
ZEND_PARSE_PARAMETERS_START(
ival.zend.cb->fcc = fcc;
}
} else {
- error_code = ZPP_ERROR_FAILURE;
+ _error_code = ZPP_ERROR_FAILURE;
break;
}
}
ZEND_PARSE_PARAMETERS_END_EX(
zend_restore_error_handling(&zeh);
- return FAILURE;
+ return false;
);
/* set up defaults */
}
zend_restore_error_handling(&zeh);
- return SUCCESS;
+ return true;
}
void psi_call_frame_enter(struct psi_call_frame *frame) {
frame->rpointer = rv_sym->ptr = rv_sym->ival_ptr;
}
-ZEND_RESULT_CODE psi_call_frame_do_let(struct psi_call_frame *frame) {
+bool psi_call_frame_do_let(struct psi_call_frame *frame) {
size_t i;
struct psi_let_stmt *let;
struct psi_decl_arg *arg;
void *temp = NULL;
frame_arg = psi_call_frame_get_var_argument(frame, i);
+ if (!frame_arg) {
+ return false;
+ }
switch (frame_arg->va_type) {
case PSI_T_BOOL: let_fn = psi_let_boolval; break;
case PSI_T_INT: let_fn = psi_let_intval; break;
case PSI_T_STRING: let_fn = psi_let_strval; break;
default:
assert(0);
+ return false;
}
frame_arg->ival_ptr = let_fn(&frame_arg->temp_val, NULL, frame_arg->va_type,
}
}
- return SUCCESS;
+ return true;
}
-ZEND_RESULT_CODE psi_call_frame_do_assert(struct psi_call_frame *frame, enum psi_assert_kind kind) {
+bool psi_call_frame_do_assert(struct psi_call_frame *frame, enum psi_assert_kind kind) {
size_t i = 0;
struct psi_assert_stmt *ass;
if (ass->kind == kind) {
if (!psi_assert_stmt_exec(ass, frame)) {
psi_assert_stmt_throw(ass);
- return FAILURE;
+ return false;
}
}
}
- return SUCCESS;
+ return true;
}
void psi_call_frame_do_call(struct psi_call_frame *frame) {
}
frame_arg = psi_call_frame_get_argument(frame, cb->func->var->fqn);
+ if (!frame_arg) {
+ return;
+ }
/* callback into userland */
ZVAL_UNDEF(&return_value);
rc = zend_fcall_info_call(&frame_arg->ival_ptr->zend.cb->fci,
&frame_arg->ival_ptr->zend.cb->fcc, &return_value, NULL);
assert(rc == SUCCESS);
+ (void) rc;
/* marshal return value of the userland call */
frame_arg->zval_ptr = &return_value;
efree(auto_list);
}
-#include "php_psi.h"
-
void psi_call_frame_free(struct psi_call_frame *frame) {
zend_hash_destroy(&frame->arguments);
zend_hash_destroy(&frame->symbols);