Skip to content

Commit cc8ac18

Browse files
committed
Finish implementing array wrapping, and add indexed property accessors.
1 parent 930d6f4 commit cc8ac18

File tree

6 files changed

+950
-44
lines changed

6 files changed

+950
-44
lines changed

src/node_php_jsobject_class.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,11 @@ class JsInvokeMsg : public MessageToJs {
439439
// the PHP thread)
440440
ZEND_BEGIN_ARG_INFO_EX(node_php_jsobject_call_args, 0, 1/*return by ref*/, 1)
441441
ZEND_ARG_INFO(0, member)
442-
ZEND_ARG_INFO(0, args)
442+
ZEND_ARG_ARRAY_INFO(0, args, 0)
443443
ZEND_END_ARG_INFO()
444444

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

473+
// I've tried setting the 'pass_rest_by_ref' parameter here to 1, but it
474+
// doesn't seem to apply. Magic methods are magic, I guess.
475+
ZEND_BEGIN_ARG_INFO_EX(node_php_jsobject_invoke_args, 0, 1/*return by ref*/, 0)
476+
ZEND_END_ARG_INFO()
477+
471478
PHP_METHOD(JsObject, __invoke) {
472479
TRACE(">");
473480
FETCH_OBJ(__invoke, this_ptr);
@@ -661,7 +668,7 @@ static const zend_function_entry node_php_jsobject_methods[] = {
661668
ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
662669
PHP_ME(JsObject, __call, node_php_jsobject_call_args,
663670
ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
664-
PHP_ME(JsObject, __invoke, nullptr,
671+
PHP_ME(JsObject, __invoke, node_php_jsobject_invoke_args,
665672
ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
666673
PHP_ME(JsObject, __tostring, node_php_jsobject_tostring_args,
667674
ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)

0 commit comments

Comments
 (0)