rfc:php_engine_constant

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:php_engine_constant [2016/09/01 17:53] daveyrfc:php_engine_constant [2020/08/01 23:50] (current) – Status is "Declined" carusogabriel
Line 1: Line 1:
 ====== PHP RFC: Add PHP Engine Identifier Constant ====== ====== PHP RFC: Add PHP Engine Identifier Constant ======
-  * Version: 0.1+  * Version: 0.2
   * Date: 2016-02-03   * Date: 2016-02-03
   * Author: Davey Shafik,davey@php.net   * Author: Davey Shafik,davey@php.net
-  * Status: Proposed+  * Status: Declined
   * First Published at: http://wiki.php.net/rfc/php_engine_constant   * First Published at: http://wiki.php.net/rfc/php_engine_constant
  
Line 10: Line 10:
 Due to the desire to maintain compatibility with PHP, alternative runtimes such as HHVM set the ''PHP_VERSION'' constant to something like ''5.6.0-hhvm'' (utilizing the ''PHP_EXTRA_VERSION'' portion of the version typically used by distros). This makes it difficult to programmatically tell the difference between when code is running on HHVM, or on PHP. While it is possible to check for ''HHVM_VERSION'' in addition to ''PHP_VERSION'' to definitively check that you are on HHVM, this doesn't scale to further implementations such as HippyVM and others. Due to the desire to maintain compatibility with PHP, alternative runtimes such as HHVM set the ''PHP_VERSION'' constant to something like ''5.6.0-hhvm'' (utilizing the ''PHP_EXTRA_VERSION'' portion of the version typically used by distros). This makes it difficult to programmatically tell the difference between when code is running on HHVM, or on PHP. While it is possible to check for ''HHVM_VERSION'' in addition to ''PHP_VERSION'' to definitively check that you are on HHVM, this doesn't scale to further implementations such as HippyVM and others.
  
-This RFC proposes to add a new constant that **explicitly** denotes the engine being used, and more importantly makes it's use as such part of the language spec.+This RFC proposes to add a new constant that **explicitly** denotes the engine being used, and //more importantly makes it's use as such part of the language spec.//
  
  
Line 23: Line 23:
  
 This would effectively make the original' ''PHP_VERSION'' and related constants indicate what version of the language spec the runtime conforms to, with PHP being the reference implementation and therefore both values would be identical. This should be standardized in the specification as the expected behavior. This would effectively make the original' ''PHP_VERSION'' and related constants indicate what version of the language spec the runtime conforms to, with PHP being the reference implementation and therefore both values would be identical. This should be standardized in the specification as the expected behavior.
 +
 +To conform to the PHP spec an alternative implementation **must**:
 +
 +  - Set ''PHP_ENGINE'' to a //string// identifying the alternative runtime
 +  - Set ''PHP_(*_)VERSION(_ID)'' to the version of the language spec they conform to
 +  - Set ''PHP_ENGINE_(*_)VERSION(_ID)'' to the alternative runtimes version
 +
 +For example, for HHVM 3.11 to conform to the spec:
 +
 +    PHP_VERSION = 7.0.0
 +    PHP_ENGINE = 'hhvm'
 +    PHP_ENGINE_VERSION = '3.11'
 +    
 +    PHP_VERSION_ID = 70000
 +    PHP_MAJOR_VERSION = 7
 +    PHP_MINOR_VERSION = 0
 +    PHP_RELEASE_VERSION = 0
 +    PHP_EXTRA_VERSION = ''
 +    
 +    PHP_ENGINE_VERSION_ID = 30110
 +    PHP_ENGINE_MAJOR_VERSION = 3
 +    PHP_ENGINE_MINOR_VERSION = 11
 +    PHP_ENGINE_RELEASE_VERSION = 0
 +    PHP_ENGINE_EXTRA_VERSION = ''
 +
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 52: Line 77:
   - ''PHP_ENGINE_EXTRA_VERSION'' — extra version info e.g.  ''-dev''   - ''PHP_ENGINE_EXTRA_VERSION'' — extra version info e.g.  ''-dev''
  
-===== Proposed Voting Choices =====+===== Vote =====
  
-This RFC will have Yes (include)/No vote with a  50%+1 majority required.+Voting is simple 50%+1 majority as there are no language changesVoting will close on September 23rd. 
 + 
 +<doodle title="Add PHP_ENGINE constant" auth="user" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle> 
 + 
 +---- 
 + 
 +<doodle title="Add PHP_(*_)ENGINE(_ID) constants" auth="user" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
Line 68: Line 105:
  
 ===== Rejected Features ===== ===== Rejected Features =====
-Keep this updated with features that were discussed on the mail lists.+ 
 + 
 + 
 + 
 + 
rfc/php_engine_constant.1472752385.txt.gz · Last modified: 2017/09/22 13:28 (external edit)