Skip to content

Commit

Permalink
Finish implementing array wrapping, and add indexed property accessors.
Browse files Browse the repository at this point in the history
  • Loading branch information
cscott committed Nov 1, 2015
1 parent 930d6f4 commit cc8ac18
Show file tree
Hide file tree
Showing 6 changed files with 950 additions and 44 deletions.
11 changes: 9 additions & 2 deletions src/node_php_jsobject_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,11 @@ class JsInvokeMsg : public MessageToJs {
// the PHP thread)
ZEND_BEGIN_ARG_INFO_EX(node_php_jsobject_call_args, 0, 1/*return by ref*/, 1)
ZEND_ARG_INFO(0, member)
ZEND_ARG_INFO(0, args)
ZEND_ARG_ARRAY_INFO(0, args, 0)
ZEND_END_ARG_INFO()

// XXX can't figure out how to pass arrays by reference instead of
// by value.
PHP_METHOD(JsObject, __call) {
zval *member; zval *args;
TRACE(">");
Expand All @@ -468,6 +470,11 @@ PHP_METHOD(JsObject, __call) {
TRACE("<");
}

// I've tried setting the 'pass_rest_by_ref' parameter here to 1, but it
// doesn't seem to apply. Magic methods are magic, I guess.
ZEND_BEGIN_ARG_INFO_EX(node_php_jsobject_invoke_args, 0, 1/*return by ref*/, 0)
ZEND_END_ARG_INFO()

PHP_METHOD(JsObject, __invoke) {
TRACE(">");
FETCH_OBJ(__invoke, this_ptr);
Expand Down Expand Up @@ -661,7 +668,7 @@ static const zend_function_entry node_php_jsobject_methods[] = {
ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(JsObject, __call, node_php_jsobject_call_args,
ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(JsObject, __invoke, nullptr,
PHP_ME(JsObject, __invoke, node_php_jsobject_invoke_args,
ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(JsObject, __tostring, node_php_jsobject_tostring_args,
ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
Expand Down
Loading

0 comments on commit cc8ac18

Please sign in to comment.