rfc:introduce-type-affinity

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:introduce-type-affinity [2015/03/16 22:10] yohgakirfc:introduce-type-affinity [2021/03/27 14:50] (current) – Move to inactive ilutov
Line 3: Line 3:
   * Date: 2015-03-16   * Date: 2015-03-16
   * Author: Yasuo Ohgaki <yohgaki@ohgaki.net>   * Author: Yasuo Ohgaki <yohgaki@ohgaki.net>
-  * Status: Draft+  * Status: Inactive
   * First Published at: http://wiki.php.net/rfc/introduce-type-affinity   * First Published at: http://wiki.php.net/rfc/introduce-type-affinity
  
Line 19: Line 19:
  
   * PHP does not have to convert ZVAL again and again. (e.g. "int" input is almost always treated as "int")   * PHP does not have to convert ZVAL again and again. (e.g. "int" input is almost always treated as "int")
-  * It works well with coercive type or strict type if PHP has it.+  * It works well with coercive type or strict type if PHP has it. (Not work well with currently proposed "strict_types", though)
   * User can omit simple data type validation and concentrate what data should like.   * User can omit simple data type validation and concentrate what data should like.
  
Line 29: Line 29:
  
   * Detect possible data type without definition/hint   * Detect possible data type without definition/hint
-  * Have INI option for type affinity conversion+  * Have INI option for type affinity conversion (When "On", affinity conversion is done always for $_GET/$_POST/etc)
   * Data is stored with native data type   * Data is stored with native data type
   * Conversion will never raise error   * Conversion will never raise error
  
   * Provide data type definition/hint prior to the conversion   * Provide data type definition/hint prior to the conversion
-  * Apply type affinity function and convert+  * Apply type affinity function and convert (User must write code unlike previous one)
   * If there is conversion error, it may raise error   * If there is conversion error, it may raise error
  
Line 40: Line 40:
 Introduce type affinity conversion function:  Introduce type affinity conversion function: 
  
-  * void type_affinitize(mixed $input [, array $definition ]);+  * void type_affinitize(mixed &$input [, array $definition ]); 
 +  * void type_affinitize_input(string $input="GPC" [, array $definition ]); \\ "GPC" is for $_GET/$_POST/$_COOKIE
  
 Type affinity may be applied to any inputs including databases/$argv/etc.  Type affinity may be applied to any inputs including databases/$argv/etc. 
rfc/introduce-type-affinity.1426543849.txt.gz · Last modified: 2017/09/22 13:28 (external edit)