rfc:zpp_improv

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:zpp_improv [2013/01/02 14:31]
cataphract [Introduction]
rfc:zpp_improv [2017/09/22 13:28] (current)
Line 15: Line 15:
 The conversions that zpp does to transform the passed zvals into native types are not trivial. For instance, it can convert a string into a "long", but not all strings will be accepted and some will be accepted but will emit a warning. As many variables end up at some point as arguments to internal functions, the behavior of zpp ends affecting how PHP's users perceive PHP's type system to work. Consequently, consistency in internal function parameter parsing is highly desirable. As zpp behavior is not trivial, achieving such consistency depends on PHP internal functions' implementations using zpp correctly. The conversions that zpp does to transform the passed zvals into native types are not trivial. For instance, it can convert a string into a "long", but not all strings will be accepted and some will be accepted but will emit a warning. As many variables end up at some point as arguments to internal functions, the behavior of zpp ends affecting how PHP's users perceive PHP's type system to work. Consequently, consistency in internal function parameter parsing is highly desirable. As zpp behavior is not trivial, achieving such consistency depends on PHP internal functions' implementations using zpp correctly.
  
-Unfortunately, zpp is also inflexible. One is restricted to a single format string, which makes implementing overloads difficult. Common solutions include calling zpp quietly several times until it succeeds (signaling a correct set of arguments) and fetching the zvals without conversion, following with explicit conversions (hopefully with convert_to_xx_ex(), not simply convert_to_xx()). These can cause several problems -- confusing error messages (or absence of them) and unanticipated side effects of failed zpp calls (which changes the arguments directly in the stack, as part as the conversion procedure, until it finds a failing condition) in the first case, and using casting behavior instead of zpp behavior in the second case (convert_to_int_ex() will happily and silently convert a resource into an integer).  +Unfortunately, zpp is also inflexible. One is restricted to a single format string, which makes implementing overloads difficult. Common solutions include calling zpp quietly several times until it succeeds (signaling a correct set of arguments) and fetching the zvals without conversion, following with explicit conversions (hopefully with convert_to_xx_ex(), not simply convert_to_xx()). These can cause several problems -- confusing error messages (or absence of them) and unanticipated side effects of failed zpp calls (which change the arguments directly in the stack, as part as the conversion procedure, until it finds a failing condition) in the first case, and using casting behavior instead of zpp behavior in the second case (convert_to_int_ex() will happily and silently convert a resource into an integer).  
  
 ===== Expose zend_parse_arg() as zend_parse_parameter() ===== ===== Expose zend_parse_arg() as zend_parse_parameter() =====
Line 48: Line 48:
  
 The mailing list discussion is available [[http://grokbase.com/p/php/php-internals/127j49y02w/zend-parse-parameters-improvements|here]]. The mailing list discussion is available [[http://grokbase.com/p/php/php-internals/127j49y02w/zend-parse-parameters-improvements|here]].
 +
 +===== Voting =====
 +
 +Voting ends not before Wednesday, January 16th 2013. The PHP language is not changed, so a 50%+1 majority is required.
 +
 +<doodle title="Accept these improvements for PHP 5.5?" auth="cataphract" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
  
 ===== Changelog ===== ===== Changelog =====
  
-- 2012-01-02: Initial revision+  * 2013-01-02: Initial revision 
 +  * 2013-01-09: Opened voting 
 +  * 2013-01-16: Closed voting
  
rfc/zpp_improv.1357137101.txt.gz · Last modified: 2017/09/22 13:28 (external edit)