preillyme/v8js — pull request #128 by stesie (2014-11-30 22:48:04+00:00)
Title: Mapping of PHP objects implementing ArrayAccess

This implements feature request https://bugs.php.net/bug.php?id=67147

If a PHP object implements ArrayAccess & Countable interfaces the object can be used quite like an array does. Not so if it is mapped to JavaScript, since we just export the object using normal object export code which just provides the `offsetGet`, `offsetSet`, etc. methods ... but no array-esque behaviour

With this patch, if the feature is enabled via php.ini setting `v8js.use_array_access` = 1, the object instead is converted into an object with index handlers (i.e. live bound like other objects) and property bridging code that maps in functions from `Array.prototype`.

See the additions to the README.md file for details + functional tests added below tests/

All the ArrayAccess handlers implementation can be found in v8js_array_access.cc file; besides I've moved the PHP -> JS object mapping code from v8js_convert.cc into a seperate file v8js_object_export.cc

Any objections to merge? Comments?

cheers
~stesie