projects
/
m6w6
/
ext-psi
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
better errors
[m6w6/ext-psi]
/
src
/
module.c
diff --git
a/src/module.c
b/src/module.c
index ff7353aeeac9cc272a030fd98181f1e5468718c0..39d12917a0c3a183f342eeb3ccbbbb75457b7a18 100644
(file)
--- a/
src/module.c
+++ b/
src/module.c
@@
-33,16
+33,25
@@
PHP_INI_END();
static zend_object_handlers psi_object_handlers;
static zend_class_entry *psi_class_entry;
static zend_object_handlers psi_object_handlers;
static zend_class_entry *psi_class_entry;
-void psi_error
(
int type, const char *msg, ...)
+void psi_error
_wrapper(PSI_Token *t,
int type, const char *msg, ...)
{
{
- char buf[0x1000];
va_list argv;
va_start(argv, msg);
va_list argv;
va_start(argv, msg);
-
vslprintf(buf, 0x100
0, msg, argv);
+
psi_verror(type, t?t->file:"Unknown", t?*t->line:
0, msg, argv);
va_end(argv);
va_end(argv);
+}
+void psi_error(int type, const char *fn, unsigned ln, const char *msg, ...)
+{
+ va_list argv;
- php_error(type, buf);
+ va_start(argv, msg);
+ psi_verror(type, fn, ln, msg, argv);
+ va_end(argv);
+}
+void psi_verror(int type, const char *fn, unsigned ln, const char *msg, va_list argv)
+{
+ zend_error_cb(type, fn, ln, msg, argv);
}
size_t psi_t_alignment(token_t t)
}
size_t psi_t_alignment(token_t t)
@@
-476,7
+485,6
@@
void psi_to_object(zval *return_value, set_value *set, impl_val *r_val)
static inline ZEND_RESULT_CODE psi_parse_args(zend_execute_data *execute_data, impl *impl)
{
size_t i;
static inline ZEND_RESULT_CODE psi_parse_args(zend_execute_data *execute_data, impl *impl)
{
size_t i;
- zval *zarg = ZEND_CALL_ARG(execute_data, 0);
impl_arg *iarg;
zend_error_handling zeh;
impl_arg *iarg;
zend_error_handling zeh;
@@
-544,10
+552,9
@@
static inline ZEND_RESULT_CODE psi_parse_args(zend_execute_data *execute_data, i
/* set up defaults */
for (i = 0; i < impl->func->args->count; ++i) {
/* set up defaults */
for (i = 0; i < impl->func->args->count; ++i) {
- iarg = impl->func->args->args[i];
+ if (i >= EX_NUM_ARGS() && iarg->def) {
+ iarg = impl->func->args->args[i];
- if (i < EX_NUM_ARGS()) {
- } else if (iarg->def) {
switch (iarg->type->type) {
case PSI_T_BOOL:
iarg->val.zend.bval = iarg->def->type == PSI_T_TRUE ? 1 : 0;
switch (iarg->type->type) {
case PSI_T_BOOL:
iarg->val.zend.bval = iarg->def->type == PSI_T_TRUE ? 1 : 0;
@@
-1174,7
+1181,7
@@
PHP_MINIT_FUNCTION(psi)
return FAILURE;
}
return FAILURE;
}
- PSI_ContextInit(&PSI_G(context), ops, psi_error);
+ PSI_ContextInit(&PSI_G(context), ops, psi_error
_wrapper
);
PSI_ContextBuild(&PSI_G(context), PSI_G(directory));
if (psi_check_env("PSI_DUMP")) {
PSI_ContextBuild(&PSI_G(context), PSI_G(directory));
if (psi_check_env("PSI_DUMP")) {