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
Last revisionBoth sides next revision
rfc:introduce-type-affinity [2015/03/16 22:09] yohgakirfc:introduce-type-affinity [2017/09/22 13:28] – external edit 127.0.0.1
Line 18: Line 18:
 Since inputs are converted to native type.  Since inputs are converted to native type. 
  
-  * PHP does not have 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.txt · Last modified: 2021/03/27 14:50 by ilutov