I have two RFCs that I'd like to propose. They are attached if anyone
wants to review them here.
===== Request for Comments: Create a new type for UTF8 strings =====
  * Version: 0.1
  * Date: 2013-02-25
  * Author: Thomas McKinzey <[email protected]>
  * Status: In Draft

===== Introduction =====

It has been suggested that PHP6 will make strings UTF8 by default. This risks 
causing a big BC break with a lot of applications that make use of binary data. 
This proposal presents a way that BC could be transparently perserved.

===== Implementation =====

==== Current Behavior ====

Right now, if you do var_dump('test') you'll get 'string(4) "test"' back. ie. 
'test' is of type 'string'.

==== Suggested Behavior ====

My proposal is that if var_dump('test') is done you'll get 'utf8string(4) 
"test"' back. To get 'string(4) "test"' you'd have to explicitely cast 'test' 
to (string). eg. var_dump((string) 'test'). So type 'string' would remain ASCII 
and 'utf8string' would be UTF-8.

This would make it so that if you wanted to make your PHP 5.5 app work with 
both PHP 5.5 and PHP 6 all you need do is explicitely cast all your strings to 
(string).

What I've read about PHP6 to date suggests that a new type - binary - be 
created. This would mean that no script that makes use of binary data could 
work on both PHP5 and PHP6 because var_dump((binary) 'test') would yield a 
syntax error on PHP 5 whereas var_dump((string) 'test') would not.

===== mbstring applications =====

This could also be done for mbstring. Right now if mbstring.func_overload is 
true strings will, by default, be in any arbitrary character type. You can't 
cast to (string) because they already are of type (string). You can't cast to 
(binary) because that doesn't exist in PHP5 and...  there's not really a lot 
you can do aside from add an if statement every time you use a string function. 
eg. (...) ? mb_strlen(...) : strlen(...)
===== Request for Comments: Add wrapper support to mysqli_connect =====
  * Version: 0.1
  * Date: 2013-02-25
  * Author: Thomas McKinzey <[email protected]>
  * Status: In Draft

===== Introduction =====

Instead of passing localhost to mysqli_connect as the $host parameter this 
option would let you pass something like 
ssh2.tunnel://user:[email protected]:22/192.168.0.1:14 to it as well.

===== Use Cases =====

==== Tunneling ====

You could tunnel through SSH2, through SOCKS, through HTTP CONNECT, etc. Even 
if those don't exist as built-in wrappers custom stream wrappers could be made. 
This would additionally make it easy for people to examine the underpinnings of 
MySQL. Instead of intercepting the packets the MySQL sends out and placing them 
into an SSH tunnel or whatever one could just dump them to a log file to better 
understand how MySQL clients work internally.
-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to