rfc:remove_zend_api:scratchpad

This is an old revision of the document!


VM extension API Scratchpad

This is an area where a number of us are brainstorming and developing ideas around the proposal for an improved interface between the PHP Virtual Machine and its extensions.

Assumptions

  • We assume that the extensions may exist in in a different address space to the VM. The extensions must not assume that they can read or write VM memory.
  • We assume that the extensions cannot use any extension interfaces other than those documented in the interface.
  • We assume that whilst there will be (are) many VMs implementing PHP, there should only be one set of extensions which run unchanged on all VMs.

List of problems to solve

Use of HashTable as a library function and an interface.

  • The problem here is that today the Zend HashTable structure is used to represent two conceptually very different things.
    • Firstly it is used to represent a PHP user space array. It is an interface type that can be passed to the VM.
    • Secondly it is used as a general programming utility to implement anything that an extension might want to use a hashtable for.
  • This makes it very difficult to know whether to route an API call to the VM interface for interaction with the VM's model of a PHP array or whether to route it to the general HashTable interface.
Solution used in IBM's Project Zero
  • We have found so far that the use of array_init to initialise the hashtable tends to signify that the hashtable is going to be used to create a user space array. Thus we use this to determine how to route API requests.

extension code which manipulates the contents of HashTables directly

Extensions which write to $php_errormsg

Folks involved in the discussion

We do not want to spam internals with hundreds of emails about our musings as we bounce ideas around but we do want to do this in the open hence this page. The folks currently involved in the discussion are as follows. If you are interested in the discussion or feel we are going about things in the wrong way please contact us:

  • Rob Nicholson (nicholsr@php.net)
  • Andy Wharmby (wharmby@php.net)
  • Iain Lewis (??iains id??)
  • Paul Biggar (paul.biggar@gmail.com)
rfc/remove_zend_api/scratchpad.1242227498.txt.gz · Last modified: 2017/09/22 13:28 (external edit)