<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>[PHP-DEV] Scalar type hinting</title>
        <description>Hi,

I create a new thread to discuss about Scalar type hinting.

Following the John Crenshaw proposed terminology:
&gt; - &quot;Strict Typing&quot; means the super strict old C style typing that has been
proven to be ridiculous in this environment because of the obvious problems
inherent in the fact that almost every input is a string.
&gt; - &quot;Weak Typing&quot; means types in the same sense that the PHP documentation
uses types (for example, the docs indicate substr(string, integer), and
substr(12345, &quot;2&quot;) == &quot;345&quot;.)
&gt; - &quot;No Scalar Typing&quot; should be used to indicate the current system (where
there is no provision for hinting at scalar types.)

Previous weak typing proposal could be found here :
https://wiki.php.net/rfc/typechecking

I have no rights to edit the wiki and make a summary of previous arguments,
so if someone could create it...


-- 
Samuel DEAL
samuel.deal@gmail.com</description>
        <link>http://www.serverphorums.com/read.php?7,451812,451812#msg-451812</link>
        <lastBuildDate>Wed, 19 Jun 2013 02:13:15 +0200</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,455073#msg-455073</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,455073#msg-455073</link>
            <description><![CDATA[ On Thu, Mar 1, 2012 at 4:18 PM, John Crenshaw &lt;johncrenshaw@priacta.com&gt; wrote:<br />
&gt; No, you've misunderstood. The average new not-really-a-developer has no concept of security. Every SQL query they write is vulnerable to injection. Every echo exposes their site to XSS vulnerabilities. Every form is vulnerable to CSRF. If they did anything with files in their script I may be able to read arbitrary files to their server and/or upload and execute arbitrary scripts. If they used eval() or system() I can probably execute arbitrary shell code and take control of the entire site. If their server is badly configured I could capture the entire machine.<br />
&gt;<br />
<br />
PHP is as vulnerable as you make it,<br />
<br />
&gt; This isn't a question of keeping software updated and not using deprecated functions, this is a question of discipline that is completely missing among the &quot;unwashed masses&quot; as you call them. The intuitive way to handle many of the most common PHP tasks is also the completely insecure way. Philosophically, I wonder if we do a great disservice by encouraging these people to tinker with code at all. We do so knowing (or at least we should know) that anything they create will inevitably be hacked. We fuel the widespread security problems that currently plague the web.<br />
&gt;<br />
&gt; John Crenshaw<br />
&gt; Priacta, Inc.<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Ronald Chmara</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 02 Mar 2012 12:20:33 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,455053#msg-455053</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,455053#msg-455053</link>
            <description><![CDATA[ Hi, All<br />
<br />
Let me update my last functions as I got an inspiration from Anthony and<br />
his proof-of-concept:<br />
<br />
foo( (boolean) $b, (integer) $i, (float) $f, (string) $s) {<br />
  // your code<br />
}<br />
foo2($b, $i, $f, $s) {<br />
  $b = (boolean)$b;<br />
  $i = (integer)$i;<br />
  $f = (float)$f;<br />
  $s = (string)$s;<br />
<br />
  // your code<br />
 }<br />
<br />
Now here a rule I thought could be acceptable to differ between the<br />
type-hint for classes and arrays and this notation:<br />
If the type is wrapped in parentheses, the system will try to convert the<br />
given value. Otherwise it will handle it strict.<br />
<br />
Strict is currently only available for classes and arrays, and I don't want<br />
to get more things in this list (excepted by resources, what is the last<br />
what would make sense here).<br />
Dynamic (the one with the parentheses) could then well be something like<br />
boolean, integer, float, string and array. Array is also in this list as I<br />
would like to have an option to give an object in here that implements all<br />
interfaces that makes an object accessible as an array - for example<br />
ArrayIterator.<br />
<br />
Bye<br />
Simon<br />
<br />
2012/3/2 Simon Schick &lt;simonsimcity@googlemail.com&gt;<br />
<br />
&gt; Hi, Kris<br />
&gt;<br />
&gt; I have to confirm that that's not really what I wanted.<br />
&gt; But many people were now talking about type-hint to scalar, but that was<br />
&gt; maybe in another thread in this list :)<br />
&gt;<br />
&gt; To get more to the point what were discussing about want:<br />
&gt; Why not always (at least try) to transform the data?<br />
&gt;<br />
&gt; In PHP 5.4 they've introduced quite a lot of new stuff around exactly that:<br />
&gt; * Changed silent conversion of array to string to produce a notice.<br />
&gt; * Changed silent casting of null/''/false into an Object when adding a<br />
&gt; property into a warning.<br />
&gt;<br />
&gt; I would suppose to add a type-hint for the following types:<br />
&gt; * Boolean<br />
&gt; * integer<br />
&gt; * float<br />
&gt; * string<br />
&gt;<br />
&gt; Here's the last state what I thought about these type-hints ...<br />
&gt; Both of the given examples here should give the same result:<br />
&gt;<br />
&gt; foo(boolean $b, integer $i, float $f, string $s) {<br />
&gt;   // your code<br />
&gt; }<br />
&gt; foo2($b, $i, $f, $s) {<br />
&gt;   $b = (boolean)$b;<br />
&gt;   $i = (integer)$i;<br />
&gt;   $f = (float)$f;<br />
&gt;   $s = (string)$s;<br />
&gt;<br />
&gt;   // your code<br />
&gt;  }<br />
&gt;<br />
&gt; If you view it from that site - you can't get an array to do what you can<br />
&gt; do with an object. Therefore I think it's quite OK to break the script<br />
&gt; there, but here, as you can transform the values, I'd (at least try to)<br />
&gt; transform the given data into the expected format.<br />
&gt; The only thing I'm quite unsure about - should we trigger a E_WARNING or<br />
&gt; E_NOTICE if we have data-loose in this transformation? Just let it pass as<br />
&gt; it's transformable, but trigger some error ...<br />
&gt; If you want to get a warning or notice in the function *foo2* then open a<br />
&gt; new thread, as I think that should not be discussed here. It affects much<br />
&gt; more than just the function-call.<br />
&gt;<br />
&gt; p.s. What about adding another type-hint for resources?<br />
&gt; That's something we could check by *is_resource()* and it would make<br />
&gt; sense (at least to me).<br />
&gt;<br />
&gt; Bye<br />
&gt; Simon<br />
&gt;<br />
&gt;<br />
&gt; 2012/3/2 Kris Craig &lt;kris.craig@gmail.com&gt;<br />
&gt;<br />
&gt;&gt; I agree with what John said.  Limiting the scope to scalars, while having<br />
&gt;&gt; some advantages, probably wouldn't pass the &quot;usefulness&quot; test for most<br />
&gt;&gt; people.<br />
&gt;&gt;<br />
&gt;&gt; --Kris<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; On Thu, Mar 1, 2012 at 4:18 PM, John Crenshaw &lt;johncrenshaw@priacta.com<br />
&gt;&gt; &gt;wrote:<br />
&gt;&gt;<br />
&gt;&gt; &gt; From: Richard Lynch [mailto:ceo@l-i-e.com]<br />
&gt;&gt; &gt; &gt; On Thu, March 1, 2012 2:38 am, John Crenshaw wrote:<br />
&gt;&gt; &gt; &gt; &gt;&gt; You might consider those scripts poor programming practice. We all<br />
&gt;&gt; &gt; &gt; &gt;&gt; do.<br />
&gt;&gt; &gt; &gt; &gt;&gt; But PHP is the language of the unwashed masses, and that was, and<br />
&gt;&gt; is,<br />
&gt;&gt; &gt; &gt; &gt;&gt; part of why it is hugely popular. Somebody who barely understands<br />
&gt;&gt; &gt; &gt; &gt;&gt; programming can pound away at the keyboard and write a bloody<br />
&gt;&gt; useful<br />
&gt;&gt; &gt; &gt; &gt;&gt; web application, breaking 10,000 Computer Science rules along the<br />
&gt;&gt; &gt; &gt; &gt;&gt; way.<br />
&gt;&gt; &gt; &gt; &gt;<br />
&gt;&gt; &gt; &gt; &gt; And in 20 minutes I can hack into that application 20 different<br />
&gt;&gt; ways.<br />
&gt;&gt; &gt; &gt; &gt; This isn't really PHP's fault...or is it? By deliberately catering<br />
&gt;&gt; to<br />
&gt;&gt; &gt; &gt; &gt; the lowest possible denominator is it possible that PHP itself<br />
&gt;&gt; &gt; &gt; &gt; contributes to the proliferation of wildly insecure web sites? I do<br />
&gt;&gt; &gt; &gt; &gt; understand the &quot;unwashed masses&quot; argument, and yet, the security<br />
&gt;&gt; geek<br />
&gt;&gt; &gt; &gt; &gt; in me sometimes questions how &quot;good&quot; this is.<br />
&gt;&gt; &gt; &gt; &gt;<br />
&gt;&gt; &gt; &gt; &gt; (Before someone flames me, I'm not really saying that we should<br />
&gt;&gt; scrap<br />
&gt;&gt; &gt; &gt; &gt; any foundational principles or tell basic users to go hang<br />
&gt;&gt; themselves.<br />
&gt;&gt; &gt; &gt; &gt; This is mostly philosophical musing.)<br />
&gt;&gt; &gt; &gt;<br />
&gt;&gt; &gt; &gt; We make concerted efforts to educate scripters, by posting the same<br />
&gt;&gt; &gt; thing in all our blogs.<br />
&gt;&gt; &gt; &gt;<br />
&gt;&gt; &gt; &gt; Even if all they understand is &quot;Don't do this!&quot; it's good enough for<br />
&gt;&gt; &gt; most of them.<br />
&gt;&gt; &gt; &gt;<br />
&gt;&gt; &gt; &gt; Other times the decision was made to just deprecate a &quot;feature&quot; and<br />
&gt;&gt; &gt; provide a migration path,<br />
&gt;&gt; &gt; &gt; if suitable, but spread out over major<br />
&gt;&gt; &gt; &gt; releases:<br />
&gt;&gt; &gt; &gt; PHP x.0: Feature is bad, but there<br />
&gt;&gt; &gt; &gt; PHP x+1.0 Feature is E_DEPRECATED (or documented as such before E_DEP)<br />
&gt;&gt; &gt; [This is the bit<br />
&gt;&gt; &gt; &gt; where a LOT of scripted edumacation has to happen.) PHP x+2.0 Feature<br />
&gt;&gt; is<br />
&gt;&gt; &gt; just gone.<br />
&gt;&gt; &gt; &gt;<br />
&gt;&gt; &gt; &gt; People who completely ignore docs or don't upgrade remain vulnerable,<br />
&gt;&gt; &gt; but there's not much<br />
&gt;&gt; &gt; &gt; you can do without making life miserable for a bazillion developers.<br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt; No, you've misunderstood. The average new not-really-a-developer has no<br />
&gt;&gt; &gt; concept of security. Every SQL query they write is vulnerable to<br />
&gt;&gt; injection.<br />
&gt;&gt; &gt; Every echo exposes their site to XSS vulnerabilities. Every form is<br />
&gt;&gt; &gt; vulnerable to CSRF. If they did anything with files in their script I<br />
&gt;&gt; may<br />
&gt;&gt; &gt; be able to read arbitrary files to their server and/or upload and<br />
&gt;&gt; execute<br />
&gt;&gt; &gt; arbitrary scripts. If they used eval() or system() I can probably<br />
&gt;&gt; execute<br />
&gt;&gt; &gt; arbitrary shell code and take control of the entire site. If their<br />
&gt;&gt; server<br />
&gt;&gt; &gt; is badly configured I could capture the entire machine.<br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt; This isn't a question of keeping software updated and not using<br />
&gt;&gt; deprecated<br />
&gt;&gt; &gt; functions, this is a question of discipline that is completely missing<br />
&gt;&gt; &gt; among the &quot;unwashed masses&quot; as you call them. The intuitive way to<br />
&gt;&gt; handle<br />
&gt;&gt; &gt; many of the most common PHP tasks is also the completely insecure way.<br />
&gt;&gt; &gt; Philosophically, I wonder if we do a great disservice by encouraging<br />
&gt;&gt; these<br />
&gt;&gt; &gt; people to tinker with code at all. We do so knowing (or at least we<br />
&gt;&gt; should<br />
&gt;&gt; &gt; know) that anything they create will inevitably be hacked. We fuel the<br />
&gt;&gt; &gt; widespread security problems that currently plague the web.<br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt; John Crenshaw<br />
&gt;&gt; &gt; Priacta, Inc.<br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt; --<br />
&gt;&gt; &gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt;&gt; &gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;&gt; &gt;<br />
&gt;&gt; &gt;<br />
&gt;&gt;<br />
&gt;<br />
&gt;]]></description>
            <dc:creator>Simon Schick</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 02 Mar 2012 11:40:03 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,455014#msg-455014</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,455014#msg-455014</link>
            <description><![CDATA[ Hi, Kris<br />
<br />
I have to confirm that that's not really what I wanted.<br />
But many people were now talking about type-hint to scalar, but that was<br />
maybe in another thread in this list :)<br />
<br />
To get more to the point what were discussing about want:<br />
Why not always (at least try) to transform the data?<br />
<br />
In PHP 5.4 they've introduced quite a lot of new stuff around exactly that:<br />
* Changed silent conversion of array to string to produce a notice.<br />
* Changed silent casting of null/''/false into an Object when adding a<br />
property into a warning.<br />
<br />
I would suppose to add a type-hint for the following types:<br />
* Boolean<br />
* integer<br />
* float<br />
* string<br />
<br />
Here's the last state what I thought about these type-hints ...<br />
Both of the given examples here should give the same result:<br />
<br />
foo(boolean $b, integer $i, float $f, string $s) {<br />
  // your code<br />
}<br />
foo2($b, $i, $f, $s) {<br />
  $b = (boolean)$b;<br />
  $i = (integer)$i;<br />
  $f = (float)$f;<br />
  $s = (string)$s;<br />
<br />
  // your code<br />
 }<br />
<br />
If you view it from that site - you can't get an array to do what you can<br />
do with an object. Therefore I think it's quite OK to break the script<br />
there, but here, as you can transform the values, I'd (at least try to)<br />
transform the given data into the expected format.<br />
The only thing I'm quite unsure about - should we trigger a E_WARNING or<br />
E_NOTICE if we have data-loose in this transformation? Just let it pass as<br />
it's transformable, but trigger some error ...<br />
If you want to get a warning or notice in the function *foo2* then open a<br />
new thread, as I think that should not be discussed here. It affects much<br />
more than just the function-call.<br />
<br />
p.s. What about adding another type-hint for resources?<br />
That's something we could check by *is_resource()* and it would make sense<br />
(at least to me).<br />
<br />
Bye<br />
Simon<br />
<br />
2012/3/2 Kris Craig &lt;kris.craig@gmail.com&gt;<br />
<br />
&gt; I agree with what John said.  Limiting the scope to scalars, while having<br />
&gt; some advantages, probably wouldn't pass the &quot;usefulness&quot; test for most<br />
&gt; people.<br />
&gt;<br />
&gt; --Kris<br />
&gt;<br />
&gt;<br />
&gt; On Thu, Mar 1, 2012 at 4:18 PM, John Crenshaw &lt;johncrenshaw@priacta.com<br />
&gt; &gt;wrote:<br />
&gt;<br />
&gt; &gt; From: Richard Lynch [mailto:ceo@l-i-e.com]<br />
&gt; &gt; &gt; On Thu, March 1, 2012 2:38 am, John Crenshaw wrote:<br />
&gt; &gt; &gt; &gt;&gt; You might consider those scripts poor programming practice. We all<br />
&gt; &gt; &gt; &gt;&gt; do.<br />
&gt; &gt; &gt; &gt;&gt; But PHP is the language of the unwashed masses, and that was, and<br />
&gt; is,<br />
&gt; &gt; &gt; &gt;&gt; part of why it is hugely popular. Somebody who barely understands<br />
&gt; &gt; &gt; &gt;&gt; programming can pound away at the keyboard and write a bloody useful<br />
&gt; &gt; &gt; &gt;&gt; web application, breaking 10,000 Computer Science rules along the<br />
&gt; &gt; &gt; &gt;&gt; way.<br />
&gt; &gt; &gt; &gt;<br />
&gt; &gt; &gt; &gt; And in 20 minutes I can hack into that application 20 different ways.<br />
&gt; &gt; &gt; &gt; This isn't really PHP's fault...or is it? By deliberately catering to<br />
&gt; &gt; &gt; &gt; the lowest possible denominator is it possible that PHP itself<br />
&gt; &gt; &gt; &gt; contributes to the proliferation of wildly insecure web sites? I do<br />
&gt; &gt; &gt; &gt; understand the &quot;unwashed masses&quot; argument, and yet, the security geek<br />
&gt; &gt; &gt; &gt; in me sometimes questions how &quot;good&quot; this is.<br />
&gt; &gt; &gt; &gt;<br />
&gt; &gt; &gt; &gt; (Before someone flames me, I'm not really saying that we should scrap<br />
&gt; &gt; &gt; &gt; any foundational principles or tell basic users to go hang<br />
&gt; themselves.<br />
&gt; &gt; &gt; &gt; This is mostly philosophical musing.)<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; We make concerted efforts to educate scripters, by posting the same<br />
&gt; &gt; thing in all our blogs.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; Even if all they understand is &quot;Don't do this!&quot; it's good enough for<br />
&gt; &gt; most of them.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; Other times the decision was made to just deprecate a &quot;feature&quot; and<br />
&gt; &gt; provide a migration path,<br />
&gt; &gt; &gt; if suitable, but spread out over major<br />
&gt; &gt; &gt; releases:<br />
&gt; &gt; &gt; PHP x.0: Feature is bad, but there<br />
&gt; &gt; &gt; PHP x+1.0 Feature is E_DEPRECATED (or documented as such before E_DEP)<br />
&gt; &gt; [This is the bit<br />
&gt; &gt; &gt; where a LOT of scripted edumacation has to happen.) PHP x+2.0 Feature<br />
&gt; is<br />
&gt; &gt; just gone.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; People who completely ignore docs or don't upgrade remain vulnerable,<br />
&gt; &gt; but there's not much<br />
&gt; &gt; &gt; you can do without making life miserable for a bazillion developers.<br />
&gt; &gt;<br />
&gt; &gt; No, you've misunderstood. The average new not-really-a-developer has no<br />
&gt; &gt; concept of security. Every SQL query they write is vulnerable to<br />
&gt; injection.<br />
&gt; &gt; Every echo exposes their site to XSS vulnerabilities. Every form is<br />
&gt; &gt; vulnerable to CSRF. If they did anything with files in their script I may<br />
&gt; &gt; be able to read arbitrary files to their server and/or upload and execute<br />
&gt; &gt; arbitrary scripts. If they used eval() or system() I can probably execute<br />
&gt; &gt; arbitrary shell code and take control of the entire site. If their server<br />
&gt; &gt; is badly configured I could capture the entire machine.<br />
&gt; &gt;<br />
&gt; &gt; This isn't a question of keeping software updated and not using<br />
&gt; deprecated<br />
&gt; &gt; functions, this is a question of discipline that is completely missing<br />
&gt; &gt; among the &quot;unwashed masses&quot; as you call them. The intuitive way to handle<br />
&gt; &gt; many of the most common PHP tasks is also the completely insecure way.<br />
&gt; &gt; Philosophically, I wonder if we do a great disservice by encouraging<br />
&gt; these<br />
&gt; &gt; people to tinker with code at all. We do so knowing (or at least we<br />
&gt; should<br />
&gt; &gt; know) that anything they create will inevitably be hacked. We fuel the<br />
&gt; &gt; widespread security problems that currently plague the web.<br />
&gt; &gt;<br />
&gt; &gt; John Crenshaw<br />
&gt; &gt; Priacta, Inc.<br />
&gt; &gt;<br />
&gt; &gt; --<br />
&gt; &gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; &gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt; &gt;<br />
&gt; &gt;<br />
&gt;]]></description>
            <dc:creator>Simon Schick</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 02 Mar 2012 10:11:08 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454851#msg-454851</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454851#msg-454851</link>
            <description><![CDATA[ I agree with what John said.  Limiting the scope to scalars, while having<br />
some advantages, probably wouldn't pass the &quot;usefulness&quot; test for most<br />
people.<br />
<br />
--Kris<br />
<br />
<br />
On Thu, Mar 1, 2012 at 4:18 PM, John Crenshaw &lt;johncrenshaw@priacta.com&gt;wrote:<br />
<br />
&gt; From: Richard Lynch [mailto:ceo@l-i-e.com]<br />
&gt; &gt; On Thu, March 1, 2012 2:38 am, John Crenshaw wrote:<br />
&gt; &gt; &gt;&gt; You might consider those scripts poor programming practice. We all<br />
&gt; &gt; &gt;&gt; do.<br />
&gt; &gt; &gt;&gt; But PHP is the language of the unwashed masses, and that was, and is,<br />
&gt; &gt; &gt;&gt; part of why it is hugely popular. Somebody who barely understands<br />
&gt; &gt; &gt;&gt; programming can pound away at the keyboard and write a bloody useful<br />
&gt; &gt; &gt;&gt; web application, breaking 10,000 Computer Science rules along the<br />
&gt; &gt; &gt;&gt; way.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; And in 20 minutes I can hack into that application 20 different ways.<br />
&gt; &gt; &gt; This isn't really PHP's fault...or is it? By deliberately catering to<br />
&gt; &gt; &gt; the lowest possible denominator is it possible that PHP itself<br />
&gt; &gt; &gt; contributes to the proliferation of wildly insecure web sites? I do<br />
&gt; &gt; &gt; understand the &quot;unwashed masses&quot; argument, and yet, the security geek<br />
&gt; &gt; &gt; in me sometimes questions how &quot;good&quot; this is.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; (Before someone flames me, I'm not really saying that we should scrap<br />
&gt; &gt; &gt; any foundational principles or tell basic users to go hang themselves.<br />
&gt; &gt; &gt; This is mostly philosophical musing.)<br />
&gt; &gt;<br />
&gt; &gt; We make concerted efforts to educate scripters, by posting the same<br />
&gt; thing in all our blogs.<br />
&gt; &gt;<br />
&gt; &gt; Even if all they understand is &quot;Don't do this!&quot; it's good enough for<br />
&gt; most of them.<br />
&gt; &gt;<br />
&gt; &gt; Other times the decision was made to just deprecate a &quot;feature&quot; and<br />
&gt; provide a migration path,<br />
&gt; &gt; if suitable, but spread out over major<br />
&gt; &gt; releases:<br />
&gt; &gt; PHP x.0: Feature is bad, but there<br />
&gt; &gt; PHP x+1.0 Feature is E_DEPRECATED (or documented as such before E_DEP)<br />
&gt; [This is the bit<br />
&gt; &gt; where a LOT of scripted edumacation has to happen.) PHP x+2.0 Feature is<br />
&gt; just gone.<br />
&gt; &gt;<br />
&gt; &gt; People who completely ignore docs or don't upgrade remain vulnerable,<br />
&gt; but there's not much<br />
&gt; &gt; you can do without making life miserable for a bazillion developers.<br />
&gt;<br />
&gt; No, you've misunderstood. The average new not-really-a-developer has no<br />
&gt; concept of security. Every SQL query they write is vulnerable to injection.<br />
&gt; Every echo exposes their site to XSS vulnerabilities. Every form is<br />
&gt; vulnerable to CSRF. If they did anything with files in their script I may<br />
&gt; be able to read arbitrary files to their server and/or upload and execute<br />
&gt; arbitrary scripts. If they used eval() or system() I can probably execute<br />
&gt; arbitrary shell code and take control of the entire site. If their server<br />
&gt; is badly configured I could capture the entire machine.<br />
&gt;<br />
&gt; This isn't a question of keeping software updated and not using deprecated<br />
&gt; functions, this is a question of discipline that is completely missing<br />
&gt; among the &quot;unwashed masses&quot; as you call them. The intuitive way to handle<br />
&gt; many of the most common PHP tasks is also the completely insecure way.<br />
&gt; Philosophically, I wonder if we do a great disservice by encouraging these<br />
&gt; people to tinker with code at all. We do so knowing (or at least we should<br />
&gt; know) that anything they create will inevitably be hacked. We fuel the<br />
&gt; widespread security problems that currently plague the web.<br />
&gt;<br />
&gt; John Crenshaw<br />
&gt; Priacta, Inc.<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
&gt;]]></description>
            <dc:creator>Kris Craig</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 02 Mar 2012 02:30:46 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454811#msg-454811</guid>
            <title>RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type  hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454811#msg-454811</link>
            <description><![CDATA[ From: Richard Lynch [mailto:ceo@l-i-e.com] <br />
&gt; On Thu, March 1, 2012 2:38 am, John Crenshaw wrote:<br />
&gt; &gt;&gt; You might consider those scripts poor programming practice. We all <br />
&gt; &gt;&gt; do.<br />
&gt; &gt;&gt; But PHP is the language of the unwashed masses, and that was, and is, <br />
&gt; &gt;&gt; part of why it is hugely popular. Somebody who barely understands <br />
&gt; &gt;&gt; programming can pound away at the keyboard and write a bloody useful <br />
&gt; &gt;&gt; web application, breaking 10,000 Computer Science rules along the <br />
&gt; &gt;&gt; way.<br />
&gt; &gt;<br />
&gt; &gt; And in 20 minutes I can hack into that application 20 different ways.<br />
&gt; &gt; This isn't really PHP's fault...or is it? By deliberately catering to <br />
&gt; &gt; the lowest possible denominator is it possible that PHP itself <br />
&gt; &gt; contributes to the proliferation of wildly insecure web sites? I do <br />
&gt; &gt; understand the &quot;unwashed masses&quot; argument, and yet, the security geek <br />
&gt; &gt; in me sometimes questions how &quot;good&quot; this is.<br />
&gt; &gt;<br />
&gt; &gt; (Before someone flames me, I'm not really saying that we should scrap <br />
&gt; &gt; any foundational principles or tell basic users to go hang themselves.<br />
&gt; &gt; This is mostly philosophical musing.)<br />
&gt;<br />
&gt; We make concerted efforts to educate scripters, by posting the same thing in all our blogs.<br />
&gt;<br />
&gt; Even if all they understand is &quot;Don't do this!&quot; it's good enough for most of them.<br />
&gt;<br />
&gt; Other times the decision was made to just deprecate a &quot;feature&quot; and provide a migration path,<br />
&gt; if suitable, but spread out over major<br />
&gt; releases:<br />
&gt; PHP x.0: Feature is bad, but there<br />
&gt; PHP x+1.0 Feature is E_DEPRECATED (or documented as such before E_DEP) [This is the bit<br />
&gt; where a LOT of scripted edumacation has to happen.) PHP x+2.0 Feature is just gone.<br />
&gt;<br />
&gt; People who completely ignore docs or don't upgrade remain vulnerable, but there's not much<br />
&gt; you can do without making life miserable for a bazillion developers.<br />
<br />
No, you've misunderstood. The average new not-really-a-developer has no concept of security. Every SQL query they write is vulnerable to injection. Every echo exposes their site to XSS vulnerabilities. Every form is vulnerable to CSRF. If they did anything with files in their script I may be able to read arbitrary files to their server and/or upload and execute arbitrary scripts. If they used eval() or system() I can probably execute arbitrary shell code and take control of the entire site. If their server is badly configured I could capture the entire machine.<br />
<br />
This isn't a question of keeping software updated and not using deprecated functions, this is a question of discipline that is completely missing among the &quot;unwashed masses&quot; as you call them. The intuitive way to handle many of the most common PHP tasks is also the completely insecure way. Philosophically, I wonder if we do a great disservice by encouraging these people to tinker with code at all. We do so knowing (or at least we should know) that anything they create will inevitably be hacked. We fuel the widespread security problems that currently plague the web.<br />
<br />
John Crenshaw<br />
Priacta, Inc.<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>John Crenshaw</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 02 Mar 2012 01:21:18 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454810#msg-454810</guid>
            <title>RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454810#msg-454810</link>
            <description><![CDATA[ From: Simon Schick [mailto:simonsimcity@googlemail.com] <br />
&gt; <br />
&gt; Hi, John<br />
&gt;<br />
&gt; Therefore I think it would be easy to explain how a type-hint for scalar could work.<br />
&gt;<br />
&gt; You can explain it as saying that the following two functions should be end up in exactly the same result, whatever you're pasting into:<br />
&gt;<br />
&gt; function foo_one(scalar $bar) {}<br />
&gt;<br />
&gt; function foo_two($bar) {<br />
&gt;  if (!is_scalar($bar))<br />
&gt;    trigger_error(&quot;Catchable fatal error: Argument ? passed to ? must be a scalar, ? given,&quot;, E_RECOVERABLE_ERROR);<br />
&gt; }<br />
<br />
Type hints that only ensure that something is a scalar are a non-starter for me. I'm not going to waste my time on something like that. You're not going to get any better core support with this, and you'll alienate support from a majority of userland as well. The average function doesn't need &quot;just a scalar, but any scalar will do&quot;. Most functions need something specific, like a string, or a number. sqrt('foo') doesn't make any sense, it needs a number, not just a scalar.<br />
<br />
John Crenshaw<br />
Priacta, Inc.]]></description>
            <dc:creator>John Crenshaw</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 02 Mar 2012 01:21:18 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454792#msg-454792</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454792#msg-454792</link>
            <description><![CDATA[ Hi, John<br />
<br />
Therefore I think it would be easy to explain how a type-hint for scalar<br />
could work.<br />
<br />
You can explain it as saying that the following two functions should be end<br />
up in exactly the same result, whatever you're pasting into:<br />
<br />
function foo_one(scalar $bar) {}<br />
<br />
function foo_two($bar) {<br />
  if (!is_scalar($bar))<br />
    trigger_error(&quot;Catchable fatal error: Argument ? passed to ? must be a<br />
scalar, ? given,&quot;, E_RECOVERABLE_ERROR);<br />
}<br />
<br />
The error-message is just an example - but that would keep the three<br />
type-hint possibilities in one and the same functionality - like just<br />
allowing exactly this type.<br />
You cannot even pass a class that extends* ArrayIterator *into a property<br />
that requires an array. So I think we should also here (at least for<br />
scalar) do a really strict thing.<br />
<br />
Bye<br />
Simon<br />
<br />
2012/3/1 John Crenshaw &lt;johncrenshaw@priacta.com&gt;<br />
<br />
&gt; &gt; &gt; &gt; From: Richard Lynch [mailto:ceo@l-i-e.com]<br />
&gt; &gt; &gt; &gt; On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote:<br />
&gt; &gt; &gt; &gt; &gt; I'm beginning to think that the type hinting question is too<br />
&gt; closely<br />
&gt; &gt; &gt; &gt; &gt; related to the dirty secrets of type juggling to resolve them<br />
&gt; &gt; &gt; &gt; &gt; separately. You may have to either discard consistency, or else fix<br />
&gt; &gt; &gt; &gt; &gt; the problem of silent bizarre conversions at the same time<br />
&gt; ('foo'==0,<br />
&gt; &gt; &gt; &gt; &gt; '123abc'=123). Fixing the conversions is a BC break though.<br />
&gt; &gt; &gt; &gt;<br />
&gt; &gt; &gt; &gt; [short version]<br />
&gt; &gt; &gt; &gt; One man's &quot;fixing&quot; is another man's &quot;feature&quot; :-)<br />
&gt; &gt; &gt; &gt;<br />
&gt; &gt; &gt; &gt; Old hands can now hit delete while I wax philosophical.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; The operative word was &quot;silent&quot;. The actual behavior is fine, but the<br />
&gt; &gt; &gt; silence is unexpected. For example, PHP happily accepts substr('foo',<br />
&gt; &gt; &gt; 'bar') with no complaint at all. From a purely philosophical<br />
&gt; perspective I<br />
&gt; &gt; &gt; think almost everyone would expect *at least* a strict notice.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; On a practical level, we have a major barrier and we'll have to decide<br />
&gt; how<br />
&gt; &gt; &gt; to handle it. As I see it we could do one of the following:<br />
&gt; &gt; &gt; 1. Discard consistency (!!)<br />
&gt; &gt; &gt; 2. Try to convince people to make these bizarre conversions not silent<br />
&gt; (BC<br />
&gt; &gt; &gt; break)<br />
&gt; &gt; &gt; 3. Try to find a creative solution to be consistent without changing<br />
&gt; &gt; &gt; anything about the conversion behavior. (I'm not seeing a way to do<br />
&gt; this<br />
&gt; &gt; &gt; one, unless we redefine &quot;consistent&quot;.)<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; John Crenshaw<br />
&gt; &gt; &gt; Priacta, Inc.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; --<br />
&gt; &gt; &gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; &gt; &gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt;<br />
&gt; &gt;<br />
&gt; &gt; On Thu, Mar 1, 2012 at 9:52 AM, Simon Schick &lt;<br />
&gt; simonsimcity@googlemail.com&gt; wrote:<br />
&gt; &gt; Hi, John<br />
&gt; &gt;<br />
&gt; &gt; Just to add an idea to yours ..<br />
&gt; &gt;<br />
&gt; &gt; Do you think it's a compatibility-break if we'd decide to send a E_NOTICE<br />
&gt; &gt; or E_WARNING if we f.e. try to give a string to a method that just allows<br />
&gt; &gt; integer for this argument?<br />
&gt; &gt; No break at all, just a E_NOTICE or E_WARNING as the script can succeed<br />
&gt; &gt; anyways.<br />
&gt; &gt; Perhaps I missed something, but since 5.3, the new parameter parsing API<br />
&gt; &gt; throws a Warning when types are not strictly honored.<br />
&gt; &gt; This has been a major feature in favor of &quot;cleaner&quot; programming.<br />
&gt; &gt;<br />
&gt; &gt; Try substr('foo', 'bar'), in PHP &gt;= 5.3 and you get a warning and the<br />
&gt; &gt; function returns null.<br />
&gt; &gt;<br />
&gt; &gt; Julien.P<br />
&gt; &gt;<br />
&gt; &gt; Bye<br />
&gt; &gt; Simon<br />
&gt; &gt;<br />
&gt;<br />
&gt; Ah, didn't notice the *new* behavior. That simplifies things substantially.<br />
&gt;<br />
&gt; I also had another realization today, which is that there's already strong<br />
&gt; precedent for treating parameter hints more aggressively than a type cast.<br />
&gt; For example, you can cast between arrays and objects, with no errors, but<br />
&gt; the type hints will still generate errors. I think this settles the<br />
&gt; consistency issue for me.<br />
&gt;<br />
&gt; John Crenshaw<br />
&gt; Priacta, Inc.<br />
&gt;]]></description>
            <dc:creator>Simon Schick</dc:creator>
            <category>php-internals</category>
            <pubDate>Fri, 02 Mar 2012 00:40:31 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454722#msg-454722</guid>
            <title>RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454722#msg-454722</link>
            <description><![CDATA[ On Thu, March 1, 2012 2:38 am, John Crenshaw wrote:<br />
&gt;&gt; You might consider those scripts poor programming practice. We all<br />
&gt;&gt; do.<br />
&gt;&gt; But PHP is the language of the unwashed masses, and that was, and<br />
&gt;&gt; is,<br />
&gt;&gt; part of why it is hugely popular. Somebody who barely understands<br />
&gt;&gt; programming can pound away at the keyboard and write a bloody useful<br />
&gt;&gt; web application, breaking 10,000 Computer Science rules along the<br />
&gt;&gt; way.<br />
&gt;<br />
&gt; And in 20 minutes I can hack into that application 20 different ways.<br />
&gt; This isn't really PHP's fault...or is it? By deliberately catering to<br />
&gt; the lowest possible denominator is it possible that PHP itself<br />
&gt; contributes to the proliferation of wildly insecure web sites? I do<br />
&gt; understand the &quot;unwashed masses&quot; argument, and yet, the security geek<br />
&gt; in me sometimes questions how &quot;good&quot; this is.<br />
&gt;<br />
&gt; (Before someone flames me, I'm not really saying that we should scrap<br />
&gt; any foundational principles or tell basic users to go hang themselves.<br />
&gt; This is mostly philosophical musing.)<br />
<br />
We make concerted efforts to educate scripters, by posting the same<br />
thing in all our blogs.<br />
<br />
Even if all they understand is &quot;Don't do this!&quot; it's good enough for<br />
most of them.<br />
<br />
Other times the decision was made to just deprecate a &quot;feature&quot; and<br />
provide a migration path, if suitable, but spread out over major<br />
releases:<br />
PHP x.0: Feature is bad, but there<br />
PHP x+1.0 Feature is E_DEPRECATED (or documented as such before E_DEP)<br />
[This is the bit where a LOT of scripted edumacation has to happen.)<br />
PHP x+2.0 Feature is just gone.<br />
<br />
People who completely ignore docs or don't upgrade remain vulnerable,<br />
but there's not much you can do without making life miserable for a<br />
bazillion developers.<br />
<br />
-- <br />
brain cancer update:<br />
<a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
Donate:<br />
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
<br />
<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Richard Lynch</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 22:50:19 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454668#msg-454668</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454668#msg-454668</link>
            <description><![CDATA[ On Thu, 01 Mar 2012 20:51:17 +0100, Kris Craig &lt;kris.craig@gmail.com&gt;  <br />
wrote:<br />
<br />
&gt; @Lester Well there's another logical fallacy.  How, exactly, am I trying  <br />
&gt; to &quot;force&quot; this on anyone?  Last time I checked, the PHP community has a<br />
&gt; voting process that requires a 2/3 majority for anything touching the<br />
&gt; code.  Also, last time I checked, there are numerous people who do want<br />
&gt; this, so I would definitely dispute some of the claims that this is &quot;dead<br />
&gt; in the water&quot; so-to-speak.<br />
&gt;<br />
&gt; [...]<br />
<br />
Seeing the same issues relitigated all over again in absurdly long threads  <br />
is annoying, but seeing these meta-discussions is exasperating (I've lost  <br />
the count of the number of e-mails just speculating about the likelihood  <br />
of success of such a proposal).<br />
<br />
So please, by all means come up with an actual proposal (implementation  <br />
included) and take it to a vote, but stop these meta-discussions and avoid  <br />
recycling arguments just so you can have the last word.<br />
<br />
-- <br />
Gustavo Lopes<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Gustavo Lopes</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 21:12:00 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454661#msg-454661</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454661#msg-454661</link>
            <description><![CDATA[ @Lester Well there's another logical fallacy.  How, exactly, am I trying to<br />
&quot;force&quot; this on anyone?  Last time I checked, the PHP community has a<br />
voting process that requires a 2/3 majority for anything touching the<br />
code.  Also, last time I checked, there are numerous people who do want<br />
this, so I would definitely dispute some of the claims that this is &quot;dead<br />
in the water&quot; so-to-speak.<br />
<br />
This has nothing whatsoever to do with implementing namespaces.  That's a<br />
non-sequitur.  Drawing a comparison because they both happen to be<br />
controversial ideas would be like me comparing you to Joseph Stalin because<br />
you both happen to breathe oxygen.  The fact alone that something is<br />
controversial does not automatically mean it's a bad idea.  Likewise, the<br />
fact that namespaces turned out to have unanticipated results does not mean<br />
that the same will happen with this.<br />
<br />
<br />
--Kris<br />
<br />
<br />
On Thu, Mar 1, 2012 at 10:06 AM, Anthony Ferrara &lt;ircmaxell@gmail.com&gt;wrote:<br />
<br />
&gt; Here's one thing to consider.  Right now casting/type-autoconversion<br />
&gt; is inconsistent at best.  Let me show you what I mean:<br />
&gt;<br />
&gt; If I add 1 to a variable, the variable is converted based on the<br />
&gt; standard <a href="http://us2.php.net/manual/en/language.types.type-juggling.php" target="_blank"  rel="nofollow">http://us2.php.net/manual/en/language.types.type-juggling.php</a><br />
&gt; type juggling rules, but the variable is attempted to be converted to<br />
&gt; a numeric type if it is not already one (based on the string<br />
&gt; conversion to numbers rules:<br />
&gt;<br />
&gt; <a href="http://us2.php.net/manual/en/language.types.string.php#language.types.string.conversion" target="_blank"  rel="nofollow">http://us2.php.net/manual/en/language.types.string.php#language.types.string.conversion</a><br />
&gt; )...  I will refer to this as &quot;Numeric Type Juggling&quot; as we go on.<br />
&gt; Note that objects cannot be used in this manner today, as they do not<br />
&gt; implement the get() object handler, so they are converted to int(1) in<br />
&gt; this context (which is defined as undefined by documentation).  Also<br />
&gt; note, that the string is cast to a number destructively.  So if you do<br />
&gt; 1 + &quot;foo&quot;, you'll get 1 back without error or warning.<br />
&gt;<br />
&gt; If I use a variable in a string context, the type juggling rules still<br />
&gt; apply, but this time converting to a string if it is not already one.<br />
&gt; This I think is the most straight forward (and sanest) of all the type<br />
&gt; rules.  I will refer to this as &quot;String Type Juggling&quot; as we go<br />
&gt; forward.  Note that object can be used in this context now, based on<br />
&gt; the __toString method.<br />
&gt;<br />
&gt; If I use a variable in a boolean context, the type juggling rules<br />
&gt; still apply.  So I can do if (array()), and the array will be<br />
&gt; internally cast to a boolean to be evaluated.  Let's call this<br />
&gt; &quot;Boolean Type Juggling&quot;...<br />
&gt;<br />
&gt; If I cast a variable to an array, it follows a standard conversion<br />
&gt; policy which is documented here:<br />
&gt;<br />
&gt; <a href="http://us2.php.net/manual/en/language.types.array.php#language.types.array.casting" target="_blank"  rel="nofollow">http://us2.php.net/manual/en/language.types.array.php#language.types.array.casting</a><br />
&gt; I'll call this &quot;Array Type Juggling&quot;...<br />
&gt;<br />
&gt; If I pass a variable to an internal function that expects a string<br />
&gt; type, the &quot;String Type Juggling&quot; rules apply.<br />
&gt;<br />
&gt; If I pass a variable to an internal function that expects a class, it<br />
&gt; will convert the variable to a string, and then lookup the class to<br />
&gt; see if it's valid.  This is the same as String Type Juggling...<br />
&gt;<br />
&gt; If I cast a variable to an object, it follows the documented casting<br />
&gt; rules.  Let's call this &quot;Object Type Juggling&quot;.<br />
&gt;<br />
&gt; If I pass a variable to an external function that expects a class,<br />
&gt; let's call this &quot;Object Hinted Type Juggling&quot;...<br />
&gt;<br />
&gt; If I pass a variable to an internal function that expects a callback,<br />
&gt; it will try to see if it's a valid callback by running logic if it's a<br />
&gt; String, Array or Object.  Other types are ignored and error out.<br />
&gt; Let's call this &quot;Callback<br />
&gt; That's where the sanity ends...<br />
&gt;<br />
&gt; If I pass a variable to an internal function that expects an integer<br />
&gt; or float, some weird things happen. If the argument is a float, it's<br />
&gt; cast to an integer.  If it's an integer, null, or boolean, it's<br />
&gt; converted directly to an integer.  But if it's an array, object or<br />
&gt; resource, it causes an error.  Up to now, it seems sane and right<br />
&gt; inline with &quot;Numeric Type Juggling&quot;.  Except that strings behave<br />
&gt; differently.  If the string is numeric (passes the is_numeric() test),<br />
&gt; then the string will be cast to an integer and proceed as expected.<br />
&gt; But if it is not, a warning is thrown and the internal function errors<br />
&gt; out.  This is quite different than &quot;Numeric Type Juggling&quot;, so I'll<br />
&gt; call it &quot;Numeric Internal Parameter Type Juggling&quot;.<br />
&gt;<br />
&gt; If I pass a variable to an internal function that expects a boolean,<br />
&gt; it sort-of works.  I can pass integers, strings, floats, and booleans,<br />
&gt; and have normal type conversion rules apply.  But if I pass in an<br />
&gt; array, object or resource, then it will error out.  So the type<br />
&gt; juggling rules work for primitives, but not for complex types, which<br />
&gt; is different from &quot;Boolean Type Juggling&quot;, so we'll call it &quot;Boolean<br />
&gt; Internal Parameter Type Juggling&quot;.<br />
&gt;<br />
&gt; If I pass a variable to an internal function that expects an array, it<br />
&gt; will error out if not.  It will not even attempt a cast, which is<br />
&gt; quite different from &quot;Array Type Juggling&quot;.  So let's call this &quot;Array<br />
&gt; Internal Parameter Type Juggling&quot; (even though it doesn't juggle<br />
&gt; anything)...<br />
&gt;<br />
&gt; If I pass a variable to an internal function that expects a hash table<br />
&gt; it can conditionally accept an object (as long as the hash table param<br />
&gt; is defined as a capital H).  This is even more different than arrays,<br />
&gt; so &quot;Hash Table Internal Parameter Type Jugging&quot;...<br />
&gt;<br />
&gt; If I pass a variable to an internal function that expects an object,<br />
&gt; it will error if it's not an object with no casting attempt.  Let's<br />
&gt; call this &quot;Object Internal Parameter Type Juggling&quot;.<br />
&gt;<br />
&gt;<br />
&gt; So in reality, there are tons of different rules and cases on how this<br />
&gt; happens.<br />
&gt;<br />
&gt; But the odd thing is that while we can wrap internal functions, we<br />
&gt; cannot use the same casting rules as they can.  So writing a wrapper<br />
&gt; for substr is non-trivial.  You **HAVE** to:<br />
&gt;<br />
&gt; function mysubstr($string, $from, $to = 0) {<br />
&gt;    if (!is_numeric($from)) {<br />
&gt;        throw new Exception('From Must Be Numeric');<br />
&gt;    }<br />
&gt;    if (!is_numeric($to)) {<br />
&gt;        throw new Exception('To Must Be Numeric');<br />
&gt;    }<br />
&gt;    return substr($string, $from, $to);<br />
&gt; }<br />
&gt;<br />
&gt; Otherwise your code will possibly throw errors.<br />
&gt;<br />
&gt; So to bring consistency in, what I would like to do is have the<br />
&gt; ability to add the same type hints (with the same casting rules) that<br />
&gt; zend_parse_parameters has into userland code.  So, have the ability to<br />
&gt; do:<br />
&gt;<br />
&gt; function (string $string, int $from, int $to = 0) {<br />
&gt; }<br />
&gt;<br />
&gt; And have the exact same functionality occur as happens with internal<br />
&gt; functions.  That will do two things: make internal code and user-land<br />
&gt; code behave consistently when it comes to type juggling, and make it<br />
&gt; easier to extend internal functionality transparently without tons of<br />
&gt; boilerplate code...<br />
&gt;<br />
&gt; Thoughts?<br />
&gt;<br />
&gt; Anthony<br />
&gt;<br />
&gt;<br />
&gt; On Thu, Mar 1, 2012 at 6:10 AM, Kiall Mac Innes &lt;kiall@managedit.ie&gt;<br />
&gt; wrote:<br />
&gt; &gt; On Thu, Mar 1, 2012 at 9:00 AM, Lester Caine &lt;lester@lsces.co.uk&gt; wrote:<br />
&gt; &gt;<br />
&gt; &gt;&gt; Both provide something that a large number of people did not or do not<br />
&gt; &gt;&gt; want anything to do with.<br />
&gt; &gt;&gt;<br />
&gt; &gt;<br />
&gt; &gt; I disagree - The majority of PHP developers I've discussed this with are<br />
&gt; &gt; in favor of adding *something *like this. Do a majority want this? I have<br />
&gt; &gt; no idea and, I honestly don't believe you do either.<br />
&gt; &gt;<br />
&gt; &gt;<br />
&gt; &gt;&gt; Namespace was forced on us in much the same way you are currently trying<br />
&gt; &gt;&gt; to force this on us.<br />
&gt; &gt;&gt;<br />
&gt; &gt;<br />
&gt; &gt; Forced? Nobody is forcing anything. Discussions are happening, and<br />
&gt; possibly<br />
&gt; &gt; a vote in the future. This is the farthest thing from being forced IMO.<br />
&gt; &gt;<br />
&gt; &gt;<br />
&gt; &gt;&gt; Many people who were pursuaded that namespace was a good idea are now<br />
&gt; &gt;&gt; realising that it wasn't and was the thin end of wedge which this<br />
&gt; &gt;&gt; discussion is once again trying to force open.<br />
&gt; &gt;&gt;<br />
&gt; &gt;<br />
&gt; &gt; Many of the popular frameworks have made the changes, or are planning to<br />
&gt; &gt; make the changes, needed to take advantage of namespaces. This, to me,<br />
&gt; &gt; suggests a general acceptable of namespaces.<br />
&gt; &gt;<br />
&gt; &gt; Also - I'm yet to hear a single complaint about namespaces<br />
&gt; &gt; - although again, I've not talked to every PHP developer!<br />
&gt; &gt;<br />
&gt; &gt; (Well.. No complaints other than the namespace separator being a '\' that<br />
&gt; &gt; is)<br />
&gt; &gt;<br />
&gt; &gt;<br />
&gt; &gt;&gt; I have no objections to 'object orientated' as that is how I have always<br />
&gt; &gt;&gt; used PHP, but the BULK of the data I am handling is simply strings which<br />
&gt; &gt;&gt; 'magically' get converted to the format I need. I don't see any use for<br />
&gt; &gt;&gt; 'type hinting' in any form since I NEED to check if a string I get in<br />
&gt; has<br />
&gt; &gt;&gt; the right data in before I store it in a database field. I don't need to<br />
&gt; &gt;&gt; throw some random error which needs handling ... I just handle the<br />
&gt; errors<br />
&gt; &gt;&gt; in line as I process the data. My framework helps to ensure what I get<br />
&gt; in<br />
&gt; &gt;&gt; is right in the first place anyway, so even the in-line checks are<br />
&gt; probably<br />
&gt; &gt;&gt; redundant nowadays!<br />
&gt; &gt;&gt;<br />
&gt; &gt;<br />
&gt; &gt; I can certainly agree with you here - have I ever absolutely NEEDED this?<br />
&gt; &gt; Nope. Would it get it the way of writing code in certain situations? Yup.<br />
&gt; &gt;<br />
&gt; &gt; But - Does that mean it's not generally useful? Nope!<br />
&gt; &gt;<br />
&gt; &gt; Kiall<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
&gt;]]></description>
            <dc:creator>Kris Craig</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 21:00:24 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454653#msg-454653</guid>
            <title>RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454653#msg-454653</link>
            <description><![CDATA[ &gt; &gt; &gt; From: Richard Lynch [mailto:ceo@l-i-e.com]<br />
&gt; &gt; &gt; On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote:<br />
&gt; &gt; &gt; &gt; I'm beginning to think that the type hinting question is too closely<br />
&gt; &gt; &gt; &gt; related to the dirty secrets of type juggling to resolve them<br />
&gt; &gt; &gt; &gt; separately. You may have to either discard consistency, or else fix<br />
&gt; &gt; &gt; &gt; the problem of silent bizarre conversions at the same time ('foo'==0,<br />
&gt; &gt; &gt; &gt; '123abc'=123). Fixing the conversions is a BC break though.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; [short version]<br />
&gt; &gt; &gt; One man's &quot;fixing&quot; is another man's &quot;feature&quot; :-)<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; Old hands can now hit delete while I wax philosophical.<br />
&gt; &gt;<br />
&gt; &gt; The operative word was &quot;silent&quot;. The actual behavior is fine, but the<br />
&gt; &gt; silence is unexpected. For example, PHP happily accepts substr('foo',<br />
&gt; &gt; 'bar') with no complaint at all. From a purely philosophical perspective I<br />
&gt; &gt; think almost everyone would expect *at least* a strict notice.<br />
&gt; &gt;<br />
&gt; &gt; On a practical level, we have a major barrier and we'll have to decide how<br />
&gt; &gt; to handle it. As I see it we could do one of the following:<br />
&gt; &gt; 1. Discard consistency (!!)<br />
&gt; &gt; 2. Try to convince people to make these bizarre conversions not silent (BC<br />
&gt; &gt; break)<br />
&gt; &gt; 3. Try to find a creative solution to be consistent without changing<br />
&gt; &gt; anything about the conversion behavior. (I'm not seeing a way to do this<br />
&gt; &gt; one, unless we redefine &quot;consistent&quot;.)<br />
&gt; &gt;<br />
&gt; &gt; John Crenshaw<br />
&gt; &gt; Priacta, Inc.<br />
&gt; &gt;<br />
&gt; &gt; --<br />
&gt; &gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; &gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt; &gt;<br />
&gt; &gt;<br />
&gt;<br />
&gt; On Thu, Mar 1, 2012 at 9:52 AM, Simon Schick &lt;simonsimcity@googlemail.com&gt; wrote:<br />
&gt; Hi, John<br />
&gt;<br />
&gt; Just to add an idea to yours ..<br />
&gt;<br />
&gt; Do you think it's a compatibility-break if we'd decide to send a E_NOTICE<br />
&gt; or E_WARNING if we f.e. try to give a string to a method that just allows<br />
&gt; integer for this argument?<br />
&gt; No break at all, just a E_NOTICE or E_WARNING as the script can succeed<br />
&gt; anyways.<br />
&gt; Perhaps I missed something, but since 5.3, the new parameter parsing API<br />
&gt; throws a Warning when types are not strictly honored.<br />
&gt; This has been a major feature in favor of &quot;cleaner&quot; programming.<br />
&gt;<br />
&gt; Try substr('foo', 'bar'), in PHP &gt;= 5.3 and you get a warning and the<br />
&gt; function returns null.<br />
&gt;<br />
&gt; Julien.P<br />
&gt;  <br />
&gt; Bye<br />
&gt; Simon<br />
&gt;<br />
<br />
Ah, didn't notice the *new* behavior. That simplifies things substantially.<br />
<br />
I also had another realization today, which is that there's already strong precedent for treating parameter hints more aggressively than a type cast. For example, you can cast between arrays and objects, with no errors, but the type hints will still generate errors. I think this settles the consistency issue for me.<br />
<br />
John Crenshaw<br />
Priacta, Inc.<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>John Crenshaw</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 20:45:05 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454574#msg-454574</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454574#msg-454574</link>
            <description><![CDATA[ Here's one thing to consider.  Right now casting/type-autoconversion<br />
is inconsistent at best.  Let me show you what I mean:<br />
<br />
If I add 1 to a variable, the variable is converted based on the<br />
standard <a href="http://us2.php.net/manual/en/language.types.type-juggling.php" target="_blank"  rel="nofollow">http://us2.php.net/manual/en/language.types.type-juggling.php</a><br />
type juggling rules, but the variable is attempted to be converted to<br />
a numeric type if it is not already one (based on the string<br />
conversion to numbers rules:<br />
<a href="http://us2.php.net/manual/en/language.types.string.php#language.types.string.conversion" target="_blank"  rel="nofollow">http://us2.php.net/manual/en/language.types.string.php#language.types.string.conversion</a><br />
)...  I will refer to this as &quot;Numeric Type Juggling&quot; as we go on.<br />
Note that objects cannot be used in this manner today, as they do not<br />
implement the get() object handler, so they are converted to int(1) in<br />
this context (which is defined as undefined by documentation).  Also<br />
note, that the string is cast to a number destructively.  So if you do<br />
1 + &quot;foo&quot;, you'll get 1 back without error or warning.<br />
<br />
If I use a variable in a string context, the type juggling rules still<br />
apply, but this time converting to a string if it is not already one.<br />
This I think is the most straight forward (and sanest) of all the type<br />
rules.  I will refer to this as &quot;String Type Juggling&quot; as we go<br />
forward.  Note that object can be used in this context now, based on<br />
the __toString method.<br />
<br />
If I use a variable in a boolean context, the type juggling rules<br />
still apply.  So I can do if (array()), and the array will be<br />
internally cast to a boolean to be evaluated.  Let's call this<br />
&quot;Boolean Type Juggling&quot;...<br />
<br />
If I cast a variable to an array, it follows a standard conversion<br />
policy which is documented here:<br />
<a href="http://us2.php.net/manual/en/language.types.array.php#language.types.array.casting" target="_blank"  rel="nofollow">http://us2.php.net/manual/en/language.types.array.php#language.types.array.casting</a><br />
I'll call this &quot;Array Type Juggling&quot;...<br />
<br />
If I pass a variable to an internal function that expects a string<br />
type, the &quot;String Type Juggling&quot; rules apply.<br />
<br />
If I pass a variable to an internal function that expects a class, it<br />
will convert the variable to a string, and then lookup the class to<br />
see if it's valid.  This is the same as String Type Juggling...<br />
<br />
If I cast a variable to an object, it follows the documented casting<br />
rules.  Let's call this &quot;Object Type Juggling&quot;.<br />
<br />
If I pass a variable to an external function that expects a class,<br />
let's call this &quot;Object Hinted Type Juggling&quot;...<br />
<br />
If I pass a variable to an internal function that expects a callback,<br />
it will try to see if it's a valid callback by running logic if it's a<br />
String, Array or Object.  Other types are ignored and error out.<br />
Let's call this &quot;Callback<br />
That's where the sanity ends...<br />
<br />
If I pass a variable to an internal function that expects an integer<br />
or float, some weird things happen. If the argument is a float, it's<br />
cast to an integer.  If it's an integer, null, or boolean, it's<br />
converted directly to an integer.  But if it's an array, object or<br />
resource, it causes an error.  Up to now, it seems sane and right<br />
inline with &quot;Numeric Type Juggling&quot;.  Except that strings behave<br />
differently.  If the string is numeric (passes the is_numeric() test),<br />
then the string will be cast to an integer and proceed as expected.<br />
But if it is not, a warning is thrown and the internal function errors<br />
out.  This is quite different than &quot;Numeric Type Juggling&quot;, so I'll<br />
call it &quot;Numeric Internal Parameter Type Juggling&quot;.<br />
<br />
If I pass a variable to an internal function that expects a boolean,<br />
it sort-of works.  I can pass integers, strings, floats, and booleans,<br />
and have normal type conversion rules apply.  But if I pass in an<br />
array, object or resource, then it will error out.  So the type<br />
juggling rules work for primitives, but not for complex types, which<br />
is different from &quot;Boolean Type Juggling&quot;, so we'll call it &quot;Boolean<br />
Internal Parameter Type Juggling&quot;.<br />
<br />
If I pass a variable to an internal function that expects an array, it<br />
will error out if not.  It will not even attempt a cast, which is<br />
quite different from &quot;Array Type Juggling&quot;.  So let's call this &quot;Array<br />
Internal Parameter Type Juggling&quot; (even though it doesn't juggle<br />
anything)...<br />
<br />
If I pass a variable to an internal function that expects a hash table<br />
it can conditionally accept an object (as long as the hash table param<br />
is defined as a capital H).  This is even more different than arrays,<br />
so &quot;Hash Table Internal Parameter Type Jugging&quot;...<br />
<br />
If I pass a variable to an internal function that expects an object,<br />
it will error if it's not an object with no casting attempt.  Let's<br />
call this &quot;Object Internal Parameter Type Juggling&quot;.<br />
<br />
<br />
So in reality, there are tons of different rules and cases on how this<br />
happens.<br />
<br />
But the odd thing is that while we can wrap internal functions, we<br />
cannot use the same casting rules as they can.  So writing a wrapper<br />
for substr is non-trivial.  You **HAVE** to:<br />
<br />
function mysubstr($string, $from, $to = 0) {<br />
    if (!is_numeric($from)) {<br />
        throw new Exception('From Must Be Numeric');<br />
    }<br />
    if (!is_numeric($to)) {<br />
        throw new Exception('To Must Be Numeric');<br />
    }<br />
    return substr($string, $from, $to);<br />
}<br />
<br />
Otherwise your code will possibly throw errors.<br />
<br />
So to bring consistency in, what I would like to do is have the<br />
ability to add the same type hints (with the same casting rules) that<br />
zend_parse_parameters has into userland code.  So, have the ability to<br />
do:<br />
<br />
function (string $string, int $from, int $to = 0) {<br />
}<br />
<br />
And have the exact same functionality occur as happens with internal<br />
functions.  That will do two things: make internal code and user-land<br />
code behave consistently when it comes to type juggling, and make it<br />
easier to extend internal functionality transparently without tons of<br />
boilerplate code...<br />
<br />
Thoughts?<br />
<br />
Anthony<br />
<br />
<br />
On Thu, Mar 1, 2012 at 6:10 AM, Kiall Mac Innes &lt;kiall@managedit.ie&gt; wrote:<br />
&gt; On Thu, Mar 1, 2012 at 9:00 AM, Lester Caine &lt;lester@lsces.co.uk&gt; wrote:<br />
&gt;<br />
&gt;&gt; Both provide something that a large number of people did not or do not<br />
&gt;&gt; want anything to do with.<br />
&gt;&gt;<br />
&gt;<br />
&gt; I disagree - The majority of PHP developers I've discussed this with are<br />
&gt; in favor of adding *something *like this. Do a majority want this? I have<br />
&gt; no idea and, I honestly don't believe you do either.<br />
&gt;<br />
&gt;<br />
&gt;&gt; Namespace was forced on us in much the same way you are currently trying<br />
&gt;&gt; to force this on us.<br />
&gt;&gt;<br />
&gt;<br />
&gt; Forced? Nobody is forcing anything. Discussions are happening, and possibly<br />
&gt; a vote in the future. This is the farthest thing from being forced IMO.<br />
&gt;<br />
&gt;<br />
&gt;&gt; Many people who were pursuaded that namespace was a good idea are now<br />
&gt;&gt; realising that it wasn't and was the thin end of wedge which this<br />
&gt;&gt; discussion is once again trying to force open.<br />
&gt;&gt;<br />
&gt;<br />
&gt; Many of the popular frameworks have made the changes, or are planning to<br />
&gt; make the changes, needed to take advantage of namespaces. This, to me,<br />
&gt; suggests a general acceptable of namespaces.<br />
&gt;<br />
&gt; Also - I'm yet to hear a single complaint about namespaces<br />
&gt; - although again, I've not talked to every PHP developer!<br />
&gt;<br />
&gt; (Well.. No complaints other than the namespace separator being a '\' that<br />
&gt; is)<br />
&gt;<br />
&gt;<br />
&gt;&gt; I have no objections to 'object orientated' as that is how I have always<br />
&gt;&gt; used PHP, but the BULK of the data I am handling is simply strings which<br />
&gt;&gt; 'magically' get converted to the format I need. I don't see any use for<br />
&gt;&gt; 'type hinting' in any form since I NEED to check if a string I get in has<br />
&gt;&gt; the right data in before I store it in a database field. I don't need to<br />
&gt;&gt; throw some random error which needs handling ... I just handle the errors<br />
&gt;&gt; in line as I process the data. My framework helps to ensure what I get in<br />
&gt;&gt; is right in the first place anyway, so even the in-line checks are probably<br />
&gt;&gt; redundant nowadays!<br />
&gt;&gt;<br />
&gt;<br />
&gt; I can certainly agree with you here - have I ever absolutely NEEDED this?<br />
&gt; Nope. Would it get it the way of writing code in certain situations? Yup.<br />
&gt;<br />
&gt; But - Does that mean it's not generally useful? Nope!<br />
&gt;<br />
&gt; Kiall<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Anthony Ferrara</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 19:11:12 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454381#msg-454381</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454381#msg-454381</link>
            <description><![CDATA[ On Thu, Mar 1, 2012 at 9:00 AM, Lester Caine &lt;lester@lsces.co.uk&gt; wrote:<br />
<br />
&gt; Both provide something that a large number of people did not or do not<br />
&gt; want anything to do with.<br />
&gt;<br />
<br />
I disagree - The majority of PHP developers I've discussed this with are<br />
in favor of adding *something *like this. Do a majority want this? I have<br />
no idea and, I honestly don't believe you do either.<br />
<br />
<br />
&gt; Namespace was forced on us in much the same way you are currently trying<br />
&gt; to force this on us.<br />
&gt;<br />
<br />
Forced? Nobody is forcing anything. Discussions are happening, and possibly<br />
a vote in the future. This is the farthest thing from being forced IMO.<br />
<br />
<br />
&gt; Many people who were pursuaded that namespace was a good idea are now<br />
&gt; realising that it wasn't and was the thin end of wedge which this<br />
&gt; discussion is once again trying to force open.<br />
&gt;<br />
<br />
Many of the popular frameworks have made the changes, or are planning to<br />
make the changes, needed to take advantage of namespaces. This, to me,<br />
suggests a general acceptable of namespaces.<br />
<br />
Also - I'm yet to hear a single complaint about namespaces<br />
- although again, I've not talked to every PHP developer!<br />
<br />
(Well.. No complaints other than the namespace separator being a '\' that<br />
is)<br />
<br />
<br />
&gt; I have no objections to 'object orientated' as that is how I have always<br />
&gt; used PHP, but the BULK of the data I am handling is simply strings which<br />
&gt; 'magically' get converted to the format I need. I don't see any use for<br />
&gt; 'type hinting' in any form since I NEED to check if a string I get in has<br />
&gt; the right data in before I store it in a database field. I don't need to<br />
&gt; throw some random error which needs handling ... I just handle the errors<br />
&gt; in line as I process the data. My framework helps to ensure what I get in<br />
&gt; is right in the first place anyway, so even the in-line checks are probably<br />
&gt; redundant nowadays!<br />
&gt;<br />
<br />
I can certainly agree with you here - have I ever absolutely NEEDED this?<br />
Nope. Would it get it the way of writing code in certain situations? Yup.<br />
<br />
But - Does that mean it's not generally useful? Nope!<br />
<br />
Kiall]]></description>
            <dc:creator>Kiall Mac Innes</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 12:20:53 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454377#msg-454377</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454377#msg-454377</link>
            <description><![CDATA[ On Thu, Mar 1, 2012 at 9:52 AM, Simon Schick &lt;simonsimcity@googlemail.com&gt;wrote:<br />
<br />
&gt; Hi, John<br />
&gt;<br />
&gt; Just to add an idea to yours ..<br />
&gt;<br />
&gt; Do you think it's a compatibility-break if we'd decide to send a E_NOTICE<br />
&gt; or E_WARNING if we f.e. try to give a string to a method that just allows<br />
&gt; integer for this argument?<br />
&gt; No break at all, just a E_NOTICE or E_WARNING as the script can succeed<br />
&gt; anyways.<br />
&gt;<br />
&gt; Perhaps I missed something, but since 5.3, the new parameter parsing API<br />
throws a Warning when types are not strictly honored.<br />
This has been a major feature in favor of &quot;cleaner&quot; programming.<br />
<br />
Try substr('foo', 'bar'), in PHP &gt;= 5.3 and you get a warning and the<br />
function returns null.<br />
<br />
Julien.P<br />
<br />
<br />
&gt; Bye<br />
&gt; Simon<br />
&gt;<br />
&gt; 2012/3/1 John Crenshaw &lt;johncrenshaw@priacta.com&gt;<br />
&gt;<br />
&gt; &gt; &gt; From: Richard Lynch [mailto:ceo@l-i-e.com]<br />
&gt; &gt; &gt; On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote:<br />
&gt; &gt; &gt; &gt; I'm beginning to think that the type hinting question is too closely<br />
&gt; &gt; &gt; &gt; related to the dirty secrets of type juggling to resolve them<br />
&gt; &gt; &gt; &gt; separately. You may have to either discard consistency, or else fix<br />
&gt; &gt; &gt; &gt; the problem of silent bizarre conversions at the same time ('foo'==0,<br />
&gt; &gt; &gt; &gt; '123abc'=123). Fixing the conversions is a BC break though.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; [short version]<br />
&gt; &gt; &gt; One man's &quot;fixing&quot; is another man's &quot;feature&quot; :-)<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; Old hands can now hit delete while I wax philosophical.<br />
&gt; &gt;<br />
&gt; &gt; The operative word was &quot;silent&quot;. The actual behavior is fine, but the<br />
&gt; &gt; silence is unexpected. For example, PHP happily accepts substr('foo',<br />
&gt; &gt; 'bar') with no complaint at all. From a purely philosophical perspective<br />
&gt; I<br />
&gt; &gt; think almost everyone would expect *at least* a strict notice.<br />
&gt; &gt;<br />
&gt; &gt; On a practical level, we have a major barrier and we'll have to decide<br />
&gt; how<br />
&gt; &gt; to handle it. As I see it we could do one of the following:<br />
&gt; &gt; 1. Discard consistency (!!)<br />
&gt; &gt; 2. Try to convince people to make these bizarre conversions not silent<br />
&gt; (BC<br />
&gt; &gt; break)<br />
&gt; &gt; 3. Try to find a creative solution to be consistent without changing<br />
&gt; &gt; anything about the conversion behavior. (I'm not seeing a way to do this<br />
&gt; &gt; one, unless we redefine &quot;consistent&quot;.)<br />
&gt; &gt;<br />
&gt; &gt; John Crenshaw<br />
&gt; &gt; Priacta, Inc.<br />
&gt; &gt;<br />
&gt; &gt; --<br />
&gt; &gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; &gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt; &gt;<br />
&gt; &gt;<br />
&gt;]]></description>
            <dc:creator>jpauli</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 12:10:35 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454293#msg-454293</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454293#msg-454293</link>
            <description><![CDATA[ &gt; That's what I was calling &quot;inconsistent&quot;, specifically because (int)'foo'<br />
&gt; == 0 with no warning whatsoever, but int $a = 'foo' would be 0 with an<br />
&gt; error of some sort. Behavior with respect to when an error is raised is<br />
&gt; inconsistent. In both cases there is a very lossy conversion, why is there<br />
&gt; an error in one case and not the other? Inconsistent.<br />
&gt;<br />
<br />
+1<br />
<br />
However, I would love to have int $a = 'foo' cast to 0 without any error.<br />
<br />
New functionality without breaking BC.<br />
<br />
<br />
<br />
Lazare INEPOLOGLOU<br />
Ingénieur Logiciel<br />
<br />
<br />
2012/3/1 John Crenshaw &lt;johncrenshaw@priacta.com&gt;<br />
<br />
&gt; From: Simon Schick [mailto:simonsimcity@googlemail.com]<br />
&gt; &gt;<br />
&gt; &gt; Hi, John<br />
&gt; &gt;<br />
&gt; &gt; Just to add an idea to yours ..<br />
&gt; &gt;<br />
&gt; &gt; Do you think it's a compatibility-break if we'd decide to send a<br />
&gt; E_NOTICE or E_WARNING if we f.e. try to give a string to a method that just<br />
&gt; allows integer for this argument?<br />
&gt; No break at all, just a E_NOTICE or E_WARNING as the script can succeed<br />
&gt; anyways.<br />
&gt; &gt;<br />
&gt; &gt; Bye<br />
&gt; &gt; Simon<br />
&gt;<br />
&gt; That's what I was calling &quot;inconsistent&quot;, specifically because (int)'foo'<br />
&gt; == 0 with no warning whatsoever, but int $a = 'foo' would be 0 with an<br />
&gt; error of some sort. Behavior with respect to when an error is raised is<br />
&gt; inconsistent. In both cases there is a very lossy conversion, why is there<br />
&gt; an error in one case and not the other? Inconsistent.<br />
&gt;<br />
&gt; On the other hand if you add an error in the legacy case now that's a BC<br />
&gt; break. One might argue that it should always have given a notice, but it<br />
&gt; didn't, so it's a change, and a BC break. Pick your poison.<br />
&gt;<br />
&gt; John Crenshaw<br />
&gt; Priacta, Inc.<br />
&gt;]]></description>
            <dc:creator>Lazare Inepologlou</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 10:12:01 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454292#msg-454292</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454292#msg-454292</link>
            <description><![CDATA[ Kris Craig wrote:<br />
&gt; With all due respect, it's a logical fallacy to draw a direct comparison<br />
&gt; between these two simply because they both happen to be uphill battles.<br />
<br />
There is a direct comparison between the two. Both provide something that a <br />
large number of people did not or do not want anything to do with. Namespace was <br />
forced on us in much the same way you are currently trying to force this on us. <br />
Many people who were pursuaded that namespace was a good idea are now realising <br />
that it wasn't and was the thin end of wedge which this discussion is once again <br />
trying to force open. I have no objections to 'object orientated' as that is how <br />
I have always used PHP, but the BULK of the data I am handling is simply strings <br />
which 'magically' get converted to the format I need. I don't see any use for <br />
'type hinting' in any form since I NEED to check if a string I get in has the <br />
right data in before I store it in a database field. I don't need to throw some <br />
random error which needs handling ... I just handle the errors in line as I <br />
process the data. My framework helps to ensure what I get in is right in the <br />
first place anyway, so even the in-line checks are probably redundant nowadays!<br />
<br />
-- <br />
Lester Caine - G8HFL<br />
-----------------------------<br />
Contact - <a href="http://lsces.co.uk/wiki/?page=contact" target="_blank"  rel="nofollow">http://lsces.co.uk/wiki/?page=contact</a><br />
L.S.Caine Electronic Services - <a href="http://lsces.co.uk" target="_blank"  rel="nofollow">http://lsces.co.uk</a><br />
EnquirySolve - <a href="http://enquirysolve.com/" target="_blank"  rel="nofollow">http://enquirysolve.com/</a><br />
Model Engineers Digital Workshop - <a href="http://medw.co.uk//" target="_blank"  rel="nofollow">http://medw.co.uk//</a><br />
Firebird - <a href="http://www.firebirdsql.org/index.php" target="_blank"  rel="nofollow">http://www.firebirdsql.org/index.php</a><br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Lester Caine</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 10:12:00 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454291#msg-454291</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454291#msg-454291</link>
            <description><![CDATA[ If any of you are interested in such change in PHP, please get<br />
together and write a complete RFC. As I do not see any kind of<br />
progress but, as you stated, some philosophical discussions. That's<br />
all good but after 2 weeks, it is time to move forward (or stop).<br />
<br />
Cheers,<br />
<br />
On Thu, Mar 1, 2012 at 4:02 AM, Richard Lynch &lt;ceo@l-i-e.com&gt; wrote:<br />
&gt; On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote:<br />
&gt;&gt; I'm beginning to think that the type hinting question is too closely<br />
&gt;&gt; related to the dirty secrets of type juggling to resolve them<br />
&gt;&gt; separately. You may have to either discard consistency, or else fix<br />
&gt;&gt; the problem of silent bizarre conversions at the same time ('foo'==0,<br />
&gt;&gt; '123abc'=123). Fixing the conversions is a BC break though.<br />
&gt;<br />
&gt; [short version]<br />
&gt; One man's &quot;fixing&quot; is another man's &quot;feature&quot; :-)<br />
&gt;<br />
&gt; Old hands can now hit delete while I wax philosophical.<br />
&gt;<br />
&gt; [long version]<br />
&gt;<br />
&gt; PHP does the type juggling because HTTP data is all string. It's a<br />
&gt; feature, because PHP's main purpose was to process HTTP input.<br />
&gt; [Yes, I know you did not dispute this. It's just foreshadowing...]<br />
&gt;<br />
&gt; Once one accepts the premise that automatic type-juggling is &quot;good&quot;,<br />
&gt; the idea that (int) &quot;123 abc&quot; turns into 123 may seem incredibly<br />
&gt; &quot;wrong&quot; or &quot;right&quot; depending on how useful one has found it.<br />
&gt;<br />
&gt; I have found it useful, and others have as well, to the point that we<br />
&gt; don't consider it something to &quot;fix&quot; but a &quot;feature&quot;<br />
&gt;<br />
&gt; Obviously, others disagree.  And that's okay. We &quot;get&quot; that some<br />
&gt; disagree, and even why some disagree. We've all coded in C, C++, C#,<br />
&gt; Forth, Modula 2, Lisp, PL/1, and many more, collectively.<br />
&gt;<br />
&gt; We choose PHP, at times, because it is the way it is, as &quot;broken&quot; as<br />
&gt; it may seem to others. And they are legion. One only needs to review<br />
&gt; blogs and mailing lists of fans of other strictly-typed languages to<br />
&gt; see this.<br />
&gt;<br />
&gt; But Breaking Compatibility with something so deeply ingrained in the<br />
&gt; culture and language, which goes back consistently at least to PHP3,<br />
&gt; and probably PHP/FI, is a non-starter.<br />
&gt;<br />
&gt; There are probably literally millions of scripts that will break &quot;out<br />
&gt; there.&quot; That's simply unacceptable, and I trust you understand why<br />
&gt; that is so.<br />
&gt;<br />
&gt; You might consider those scripts poor programming practice. We all do.<br />
&gt; But PHP is the language of the unwashed masses, and that was, and is,<br />
&gt; part of why it is hugely popular. Somebody who barely understands<br />
&gt; programming can pound away at the keyboard and write a bloody useful<br />
&gt; web application, breaking 10,000 Computer Science rules along the way.<br />
&gt;<br />
&gt; It's duct tape and bailing wire. And we love it for that.<br />
&gt;<br />
&gt; If the app is useful enough, it might even get cleaned up.  Or just<br />
&gt; more duct tape and bailing wire is applied, more likely. :-)<br />
&gt;<br />
&gt; Even at a major release, PHP has, by and large, strived to remain<br />
&gt; Backwards Compatible, unless a VERY compelling reason was presented.<br />
&gt;<br />
&gt; A vocal minority, or even a majority, of developers does not qualify.<br />
&gt; That's pretty much why the Core Devs' &quot;veto&quot; power exists.<br />
&gt;<br />
&gt; Some of the proposals and ideas lately have adhered to that concept of<br />
&gt; not breaking Backwards Compatibility. Others have not, and those are<br />
&gt; just non-starters.<br />
&gt;<br />
&gt; But PHP core has always had the mantra &quot;Keep It Simple, Stupid&quot;<br />
&gt;<br />
&gt; If one wants a complex language, PHP is simply not going to be it, and<br />
&gt; virtually all of these proposals do not fit the KISS principle, at a<br />
&gt; fundamental level of &quot;Any idiot can read halfway decent code and<br />
&gt; puzzle out what it does in less than a day.&quot;<br />
&gt;<br />
&gt; This is a Religious Issue, a personal preference, a philosophical<br />
&gt; ideal, etc. Right or wrong, it is what it is, by choice, by the core<br />
&gt; developers who have put years worth of effort into it.<br />
&gt;<br />
&gt; Please don't read this as &quot;go away&quot; or a restatement of the arguments<br />
&gt; that have been labeled as circular before.  I am merely trying to<br />
&gt; explain why PHP is the way it is, at a 10,000 foot level, and why so<br />
&gt; many core devs are resistant to the changes being proposed.<br />
&gt;<br />
&gt; I highly respect all the efforts and the alternative philosophical<br />
&gt; differences, and even the guiding principles of Computer Science<br />
&gt; driving them. PHP is just not the language for Computer Science types,<br />
&gt; for the most part. It's for the masses.<br />
&gt;<br />
&gt; Some CS types like it in certain situations, which is all to the good,<br />
&gt; or it would be a total mess :-) We embrace its &quot;flaws&quot; and ugly hacks<br />
&gt; because, like it or not, &quot;it works&quot; for what it's designed to do.<br />
&gt;<br />
&gt; --<br />
&gt; brain cancer update:<br />
&gt; <a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
&gt; Donate:<br />
&gt; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
<br />
<br />
<br />
-- <br />
Pierre<br />
<br />
@pierrejoye | <a href="http://blog.thepimp.net" target="_blank"  rel="nofollow">http://blog.thepimp.net</a> | <a href="http://www.libgd.org" target="_blank"  rel="nofollow">http://www.libgd.org</a><br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Pierre Joye</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 10:12:00 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454290#msg-454290</guid>
            <title>RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454290#msg-454290</link>
            <description><![CDATA[ From: Simon Schick [mailto:simonsimcity@googlemail.com] <br />
&gt;<br />
&gt; Hi, John<br />
&gt;<br />
&gt; Just to add an idea to yours ..<br />
&gt;<br />
&gt; Do you think it's a compatibility-break if we'd decide to send a E_NOTICE or E_WARNING if we f.e. try to give a string to a method that just allows integer for this argument?<br />
No break at all, just a E_NOTICE or E_WARNING as the script can succeed anyways.<br />
&gt;<br />
&gt; Bye<br />
&gt; Simon<br />
<br />
That's what I was calling &quot;inconsistent&quot;, specifically because (int)'foo' == 0 with no warning whatsoever, but int $a = 'foo' would be 0 with an error of some sort. Behavior with respect to when an error is raised is inconsistent. In both cases there is a very lossy conversion, why is there an error in one case and not the other? Inconsistent.<br />
<br />
On the other hand if you add an error in the legacy case now that's a BC break. One might argue that it should always have given a notice, but it didn't, so it's a change, and a BC break. Pick your poison.<br />
<br />
John Crenshaw<br />
Priacta, Inc.]]></description>
            <dc:creator>John Crenshaw</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 10:12:00 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454281#msg-454281</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454281#msg-454281</link>
            <description><![CDATA[ Hi, John<br />
<br />
Just to add an idea to yours ..<br />
<br />
Do you think it's a compatibility-break if we'd decide to send a E_NOTICE<br />
or E_WARNING if we f.e. try to give a string to a method that just allows<br />
integer for this argument?<br />
No break at all, just a E_NOTICE or E_WARNING as the script can succeed<br />
anyways.<br />
<br />
Bye<br />
Simon<br />
<br />
2012/3/1 John Crenshaw &lt;johncrenshaw@priacta.com&gt;<br />
<br />
&gt; &gt; From: Richard Lynch [mailto:ceo@l-i-e.com]<br />
&gt; &gt; On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote:<br />
&gt; &gt; &gt; I'm beginning to think that the type hinting question is too closely<br />
&gt; &gt; &gt; related to the dirty secrets of type juggling to resolve them<br />
&gt; &gt; &gt; separately. You may have to either discard consistency, or else fix<br />
&gt; &gt; &gt; the problem of silent bizarre conversions at the same time ('foo'==0,<br />
&gt; &gt; &gt; '123abc'=123). Fixing the conversions is a BC break though.<br />
&gt; &gt;<br />
&gt; &gt; [short version]<br />
&gt; &gt; One man's &quot;fixing&quot; is another man's &quot;feature&quot; :-)<br />
&gt; &gt;<br />
&gt; &gt; Old hands can now hit delete while I wax philosophical.<br />
&gt;<br />
&gt; The operative word was &quot;silent&quot;. The actual behavior is fine, but the<br />
&gt; silence is unexpected. For example, PHP happily accepts substr('foo',<br />
&gt; 'bar') with no complaint at all. From a purely philosophical perspective I<br />
&gt; think almost everyone would expect *at least* a strict notice.<br />
&gt;<br />
&gt; On a practical level, we have a major barrier and we'll have to decide how<br />
&gt; to handle it. As I see it we could do one of the following:<br />
&gt; 1. Discard consistency (!!)<br />
&gt; 2. Try to convince people to make these bizarre conversions not silent (BC<br />
&gt; break)<br />
&gt; 3. Try to find a creative solution to be consistent without changing<br />
&gt; anything about the conversion behavior. (I'm not seeing a way to do this<br />
&gt; one, unless we redefine &quot;consistent&quot;.)<br />
&gt;<br />
&gt; John Crenshaw<br />
&gt; Priacta, Inc.<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
&gt;]]></description>
            <dc:creator>Simon Schick</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 10:00:20 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454277#msg-454277</guid>
            <title>RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454277#msg-454277</link>
            <description><![CDATA[ &gt; From: Richard Lynch [mailto:ceo@l-i-e.com] <br />
&gt; On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote:<br />
&gt; &gt; I'm beginning to think that the type hinting question is too closely <br />
&gt; &gt; related to the dirty secrets of type juggling to resolve them <br />
&gt; &gt; separately. You may have to either discard consistency, or else fix <br />
&gt; &gt; the problem of silent bizarre conversions at the same time ('foo'==0, <br />
&gt; &gt; '123abc'=123). Fixing the conversions is a BC break though.<br />
&gt; <br />
&gt; [short version]<br />
&gt; One man's &quot;fixing&quot; is another man's &quot;feature&quot; :-)<br />
&gt; <br />
&gt; Old hands can now hit delete while I wax philosophical.<br />
<br />
The operative word was &quot;silent&quot;. The actual behavior is fine, but the silence is unexpected. For example, PHP happily accepts substr('foo', 'bar') with no complaint at all. From a purely philosophical perspective I think almost everyone would expect *at least* a strict notice.<br />
<br />
On a practical level, we have a major barrier and we'll have to decide how to handle it. As I see it we could do one of the following:<br />
1. Discard consistency (!!)<br />
2. Try to convince people to make these bizarre conversions not silent (BC break)<br />
3. Try to find a creative solution to be consistent without changing anything about the conversion behavior. (I'm not seeing a way to do this one, unless we redefine &quot;consistent&quot;.)<br />
<br />
John Crenshaw<br />
Priacta, Inc.<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>John Crenshaw</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 09:50:50 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454276#msg-454276</guid>
            <title>RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454276#msg-454276</link>
            <description><![CDATA[ Secure code is not about the instrument, it's about how you write it.<br />
Insecure spagetti code can be written in any language.]]></description>
            <dc:creator>Arvids Godjuks</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 09:50:50 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454272#msg-454272</guid>
            <title>RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454272#msg-454272</link>
            <description><![CDATA[ &gt; You might consider those scripts poor programming practice. We all do.<br />
&gt; But PHP is the language of the unwashed masses, and that was, and is, <br />
&gt; part of why it is hugely popular. Somebody who barely understands <br />
&gt; programming can pound away at the keyboard and write a bloody useful <br />
&gt; web application, breaking 10,000 Computer Science rules along the way.<br />
<br />
And in 20 minutes I can hack into that application 20 different ways. This isn't really PHP's fault...or is it? By deliberately catering to the lowest possible denominator is it possible that PHP itself contributes to the proliferation of wildly insecure web sites? I do understand the &quot;unwashed masses&quot; argument, and yet, the security geek in me sometimes questions how &quot;good&quot; this is.<br />
<br />
(Before someone flames me, I'm not really saying that we should scrap any foundational principles or tell basic users to go hang themselves. This is mostly philosophical musing.)<br />
<br />
John Crenshaw<br />
Priacta, Inc.<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>John Crenshaw</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 09:40:08 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454203#msg-454203</guid>
            <title>Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454203#msg-454203</link>
            <description><![CDATA[ I agree with your well-thought-out remarks overall.  However (and you  knew<br />
a &quot;however&quot; was coming lol), by making these types optional, we would be<br />
allowing full backwards-compatibility without alienating non-CS developers,<br />
since they would be able to continue writing the same code they do now.<br />
Likewise, and I know I keep going back to this, PHP 5's stronger<br />
implementation of OO did not break backwards compatibility or scare away<br />
procedural developers who are not versed on OO concepts.  I would cite that<br />
as precedent for this; in that, if done correctly and with great care, this<br />
can be implemented without trampling on PHP's KISS principles IMHO.<br />
<br />
--Kris<br />
<br />
<br />
On Wed, Feb 29, 2012 at 7:02 PM, Richard Lynch &lt;ceo@l-i-e.com&gt; wrote:<br />
<br />
&gt; On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote:<br />
&gt; &gt; I'm beginning to think that the type hinting question is too closely<br />
&gt; &gt; related to the dirty secrets of type juggling to resolve them<br />
&gt; &gt; separately. You may have to either discard consistency, or else fix<br />
&gt; &gt; the problem of silent bizarre conversions at the same time ('foo'==0,<br />
&gt; &gt; '123abc'=123). Fixing the conversions is a BC break though.<br />
&gt;<br />
&gt; [short version]<br />
&gt; One man's &quot;fixing&quot; is another man's &quot;feature&quot; :-)<br />
&gt;<br />
&gt; Old hands can now hit delete while I wax philosophical.<br />
&gt;<br />
&gt; [long version]<br />
&gt;<br />
&gt; PHP does the type juggling because HTTP data is all string. It's a<br />
&gt; feature, because PHP's main purpose was to process HTTP input.<br />
&gt; [Yes, I know you did not dispute this. It's just foreshadowing...]<br />
&gt;<br />
&gt; Once one accepts the premise that automatic type-juggling is &quot;good&quot;,<br />
&gt; the idea that (int) &quot;123 abc&quot; turns into 123 may seem incredibly<br />
&gt; &quot;wrong&quot; or &quot;right&quot; depending on how useful one has found it.<br />
&gt;<br />
&gt; I have found it useful, and others have as well, to the point that we<br />
&gt; don't consider it something to &quot;fix&quot; but a &quot;feature&quot;<br />
&gt;<br />
&gt; Obviously, others disagree.  And that's okay. We &quot;get&quot; that some<br />
&gt; disagree, and even why some disagree. We've all coded in C, C++, C#,<br />
&gt; Forth, Modula 2, Lisp, PL/1, and many more, collectively.<br />
&gt;<br />
&gt; We choose PHP, at times, because it is the way it is, as &quot;broken&quot; as<br />
&gt; it may seem to others. And they are legion. One only needs to review<br />
&gt; blogs and mailing lists of fans of other strictly-typed languages to<br />
&gt; see this.<br />
&gt;<br />
&gt; But Breaking Compatibility with something so deeply ingrained in the<br />
&gt; culture and language, which goes back consistently at least to PHP3,<br />
&gt; and probably PHP/FI, is a non-starter.<br />
&gt;<br />
&gt; There are probably literally millions of scripts that will break &quot;out<br />
&gt; there.&quot; That's simply unacceptable, and I trust you understand why<br />
&gt; that is so.<br />
&gt;<br />
&gt; You might consider those scripts poor programming practice. We all do.<br />
&gt; But PHP is the language of the unwashed masses, and that was, and is,<br />
&gt; part of why it is hugely popular. Somebody who barely understands<br />
&gt; programming can pound away at the keyboard and write a bloody useful<br />
&gt; web application, breaking 10,000 Computer Science rules along the way.<br />
&gt;<br />
&gt; It's duct tape and bailing wire. And we love it for that.<br />
&gt;<br />
&gt; If the app is useful enough, it might even get cleaned up.  Or just<br />
&gt; more duct tape and bailing wire is applied, more likely. :-)<br />
&gt;<br />
&gt; Even at a major release, PHP has, by and large, strived to remain<br />
&gt; Backwards Compatible, unless a VERY compelling reason was presented.<br />
&gt;<br />
&gt; A vocal minority, or even a majority, of developers does not qualify.<br />
&gt; That's pretty much why the Core Devs' &quot;veto&quot; power exists.<br />
&gt;<br />
&gt; Some of the proposals and ideas lately have adhered to that concept of<br />
&gt; not breaking Backwards Compatibility. Others have not, and those are<br />
&gt; just non-starters.<br />
&gt;<br />
&gt; But PHP core has always had the mantra &quot;Keep It Simple, Stupid&quot;<br />
&gt;<br />
&gt; If one wants a complex language, PHP is simply not going to be it, and<br />
&gt; virtually all of these proposals do not fit the KISS principle, at a<br />
&gt; fundamental level of &quot;Any idiot can read halfway decent code and<br />
&gt; puzzle out what it does in less than a day.&quot;<br />
&gt;<br />
&gt; This is a Religious Issue, a personal preference, a philosophical<br />
&gt; ideal, etc. Right or wrong, it is what it is, by choice, by the core<br />
&gt; developers who have put years worth of effort into it.<br />
&gt;<br />
&gt; Please don't read this as &quot;go away&quot; or a restatement of the arguments<br />
&gt; that have been labeled as circular before.  I am merely trying to<br />
&gt; explain why PHP is the way it is, at a 10,000 foot level, and why so<br />
&gt; many core devs are resistant to the changes being proposed.<br />
&gt;<br />
&gt; I highly respect all the efforts and the alternative philosophical<br />
&gt; differences, and even the guiding principles of Computer Science<br />
&gt; driving them. PHP is just not the language for Computer Science types,<br />
&gt; for the most part. It's for the masses.<br />
&gt;<br />
&gt; Some CS types like it in certain situations, which is all to the good,<br />
&gt; or it would be a total mess :-) We embrace its &quot;flaws&quot; and ugly hacks<br />
&gt; because, like it or not, &quot;it works&quot; for what it's designed to do.<br />
&gt;<br />
&gt; --<br />
&gt; brain cancer update:<br />
&gt; <a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
&gt; Donate:<br />
&gt;<br />
&gt; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
&gt;]]></description>
            <dc:creator>Kris Craig</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 04:20:25 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454202#msg-454202</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454202#msg-454202</link>
            <description><![CDATA[ Bah and after all that, I went and misspelled *Symantec.  *grumbles*<br />
<br />
--Kris<br />
<br />
<br />
On Wed, Feb 29, 2012 at 7:01 PM, Kris Craig &lt;kris.craig@gmail.com&gt; wrote:<br />
<br />
&gt; @Richard Yeah that sounds about right actually.  That's probably exactly<br />
&gt; the reasoning behind the current model being what it is.<br />
&gt;<br />
&gt; However, it seems to me that, especially in complex proposals, the &quot;should<br />
&gt; we?&quot; and the &quot;how?&quot; distinction becomes more and more difficult to avoid.<br />
&gt; If everyone supports an idea, but there are a hundred different viable ways<br />
&gt; to do it, having a hundred different competing proposals would be a<br />
&gt; nightmare IMHO (especially if fifty of them passed and are directly<br />
&gt; conflicting with one another lol).<br />
&gt;<br />
&gt; That's why I'm thinking, if you split them into separate questions but<br />
&gt; keep them in the same overall proposal, you can wind up with the best of<br />
&gt; both worlds.  The &quot;primary&quot; question is whether or not this should be done<br />
&gt; to begin with; if it fails, then everything else is moot.  If it passes, on<br />
&gt; the other hand, then the plurality on any secondary question(s) would allow<br />
&gt; us to simultaneously and efficiently decide *how* it should be<br />
&gt; implemented without having to create separate proposals or cause the<br />
&gt; support vote to become split (since your vote(s) to any secondary questions<br />
&gt; would have no bearing on your primary question vote).<br />
&gt;<br />
&gt; For example, let's time-travel ten years into the future.  I wanted to<br />
&gt; modify PHP 7.3's configure script to use a botnet I control to increase<br />
&gt; PHP's processing power (as of PHP 7, PHP can exploit rootkits but it can't<br />
&gt; control entire botnets).  If enabled, the RFC argues, I'd be able to<br />
&gt; increase my spam output tenfold and still have enough victim machines to<br />
&gt; carry out a DoS attack against FaceGoo+ (yep, they merged) and silence my<br />
&gt; many enemies.  But then, there a serious problem surrounding this proposal<br />
&gt; that someone raises:  Should there be a switch to activate this or should<br />
&gt; it simply be configure's default behavior?  Also, should this include a<br />
&gt; switch that instructs PHP to install a rootkit on vulnerable systems<br />
&gt; automatically, and if so, should we integrate that with the main switch,<br />
&gt; make it a separate switch, or just make it the default behavior as well?<br />
&gt;<br />
&gt; Naturally, this would best be handled as a single RFC.  The &quot;primary&quot;<br />
&gt; question would be something along the lines of, &quot;Should PHP's built-in<br />
&gt; trojan management capabilities be expanded to allow for control of large<br />
&gt; botnets (yes/no)?&quot;<br />
&gt;<br />
&gt; Then, there would be some secondary questions; for each one, the prefix<br />
&gt; &quot;If implemented....&quot; is assumed:  &quot;Should the the switch be enabled by<br />
&gt; default (yes/no),&quot; &quot;How should rootkit install toggling be handled (option<br />
&gt; on main switch/separate switch/just make it default),&quot; and, &quot;Should we<br />
&gt; commit another series of arsons at Semantic in order to slow the<br />
&gt; development of new security patches that might hinder our supreme<br />
&gt; objective?&quot;<br />
&gt;<br />
&gt;<br />
&gt; Heh sorry, my examples tend to get a bit psychotic after a long day at<br />
&gt; work.  But you have the gist of it, at least.  ;)<br />
&gt;<br />
&gt; --Kris<br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt; On Wed, Feb 29, 2012 at 6:32 PM, Richard Lynch &lt;ceo@l-i-e.com&gt; wrote:<br />
&gt;<br />
&gt;&gt; On Wed, February 29, 2012 6:55 pm, Kris Craig wrote:<br />
&gt;&gt; &gt; If not, I'll go ahead and draft an RFC for these proposed amendments<br />
&gt;&gt; &gt; sometime today or tomorrow when I get a spare moment.  If anyone has<br />
&gt;&gt; &gt; any<br />
&gt;&gt; &gt; thoughts on this, please share them!  Thanks!<br />
&gt;&gt;<br />
&gt;&gt; This is not an official answer. I don't have time to dig out references.<br />
&gt;&gt;<br />
&gt;&gt; I believe the PHP community settled on the idea of having a single<br />
&gt;&gt; simple pass / fail vote without the complexity of branches / options.<br />
&gt;&gt;<br />
&gt;&gt; It was simply to hard to tally the votes once you open up the options,<br />
&gt;&gt; because your support base ends up being split.<br />
&gt;&gt;<br />
&gt;&gt; NOTE: See current  US Republican Primaries for examples of how complex<br />
&gt;&gt; it gets. :-)<br />
&gt;&gt;<br />
&gt;&gt; There is nothing to stop one from drafting multiple proposals, with<br />
&gt;&gt; alternative options, and each one getting vote upon, other than the<br />
&gt;&gt; time available to the person drafting the proposals.<br />
&gt;&gt;<br />
&gt;&gt; And, of course, a reasonable expectation that with TOO many proposals<br />
&gt;&gt; of the same idea, the community would quickly turn into robo-voting,<br />
&gt;&gt; both for and against, as that's just human nature.<br />
&gt;&gt;<br />
&gt;&gt; Again, I say, I don't claim to speak for the whole community.  This is<br />
&gt;&gt; merely my interpretation from my faulty memory of past events.<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; brain cancer update:<br />
&gt;&gt; <a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
&gt;&gt; Donate:<br />
&gt;&gt;<br />
&gt;&gt; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt; --<br />
&gt;&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt;&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;]]></description>
            <dc:creator>Kris Craig</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 04:20:24 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454201#msg-454201</guid>
            <title>[PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454201#msg-454201</link>
            <description><![CDATA[ On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote:<br />
&gt; I'm beginning to think that the type hinting question is too closely<br />
&gt; related to the dirty secrets of type juggling to resolve them<br />
&gt; separately. You may have to either discard consistency, or else fix<br />
&gt; the problem of silent bizarre conversions at the same time ('foo'==0,<br />
&gt; '123abc'=123). Fixing the conversions is a BC break though.<br />
<br />
[short version]<br />
One man's &quot;fixing&quot; is another man's &quot;feature&quot; :-)<br />
<br />
Old hands can now hit delete while I wax philosophical.<br />
<br />
[long version]<br />
<br />
PHP does the type juggling because HTTP data is all string. It's a<br />
feature, because PHP's main purpose was to process HTTP input.<br />
[Yes, I know you did not dispute this. It's just foreshadowing...]<br />
<br />
Once one accepts the premise that automatic type-juggling is &quot;good&quot;,<br />
the idea that (int) &quot;123 abc&quot; turns into 123 may seem incredibly<br />
&quot;wrong&quot; or &quot;right&quot; depending on how useful one has found it.<br />
<br />
I have found it useful, and others have as well, to the point that we<br />
don't consider it something to &quot;fix&quot; but a &quot;feature&quot;<br />
<br />
Obviously, others disagree.  And that's okay. We &quot;get&quot; that some<br />
disagree, and even why some disagree. We've all coded in C, C++, C#,<br />
Forth, Modula 2, Lisp, PL/1, and many more, collectively.<br />
<br />
We choose PHP, at times, because it is the way it is, as &quot;broken&quot; as<br />
it may seem to others. And they are legion. One only needs to review<br />
blogs and mailing lists of fans of other strictly-typed languages to<br />
see this.<br />
<br />
But Breaking Compatibility with something so deeply ingrained in the<br />
culture and language, which goes back consistently at least to PHP3,<br />
and probably PHP/FI, is a non-starter.<br />
<br />
There are probably literally millions of scripts that will break &quot;out<br />
there.&quot; That's simply unacceptable, and I trust you understand why<br />
that is so.<br />
<br />
You might consider those scripts poor programming practice. We all do.<br />
But PHP is the language of the unwashed masses, and that was, and is,<br />
part of why it is hugely popular. Somebody who barely understands<br />
programming can pound away at the keyboard and write a bloody useful<br />
web application, breaking 10,000 Computer Science rules along the way.<br />
<br />
It's duct tape and bailing wire. And we love it for that.<br />
<br />
If the app is useful enough, it might even get cleaned up.  Or just<br />
more duct tape and bailing wire is applied, more likely. :-)<br />
<br />
Even at a major release, PHP has, by and large, strived to remain<br />
Backwards Compatible, unless a VERY compelling reason was presented.<br />
<br />
A vocal minority, or even a majority, of developers does not qualify.<br />
That's pretty much why the Core Devs' &quot;veto&quot; power exists.<br />
<br />
Some of the proposals and ideas lately have adhered to that concept of<br />
not breaking Backwards Compatibility. Others have not, and those are<br />
just non-starters.<br />
<br />
But PHP core has always had the mantra &quot;Keep It Simple, Stupid&quot;<br />
<br />
If one wants a complex language, PHP is simply not going to be it, and<br />
virtually all of these proposals do not fit the KISS principle, at a<br />
fundamental level of &quot;Any idiot can read halfway decent code and<br />
puzzle out what it does in less than a day.&quot;<br />
<br />
This is a Religious Issue, a personal preference, a philosophical<br />
ideal, etc. Right or wrong, it is what it is, by choice, by the core<br />
developers who have put years worth of effort into it.<br />
<br />
Please don't read this as &quot;go away&quot; or a restatement of the arguments<br />
that have been labeled as circular before.  I am merely trying to<br />
explain why PHP is the way it is, at a 10,000 foot level, and why so<br />
many core devs are resistant to the changes being proposed.<br />
<br />
I highly respect all the efforts and the alternative philosophical<br />
differences, and even the guiding principles of Computer Science<br />
driving them. PHP is just not the language for Computer Science types,<br />
for the most part. It's for the masses.<br />
<br />
Some CS types like it in certain situations, which is all to the good,<br />
or it would be a total mess :-) We embrace its &quot;flaws&quot; and ugly hacks<br />
because, like it or not, &quot;it works&quot; for what it's designed to do.<br />
<br />
-- <br />
brain cancer update:<br />
<a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
Donate:<br />
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
<br />
<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Richard Lynch</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 04:20:24 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454200#msg-454200</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454200#msg-454200</link>
            <description><![CDATA[ @Richard Yeah that sounds about right actually.  That's probably exactly<br />
the reasoning behind the current model being what it is.<br />
<br />
However, it seems to me that, especially in complex proposals, the &quot;should<br />
we?&quot; and the &quot;how?&quot; distinction becomes more and more difficult to avoid.<br />
If everyone supports an idea, but there are a hundred different viable ways<br />
to do it, having a hundred different competing proposals would be a<br />
nightmare IMHO (especially if fifty of them passed and are directly<br />
conflicting with one another lol).<br />
<br />
That's why I'm thinking, if you split them into separate questions but keep<br />
them in the same overall proposal, you can wind up with the best of both<br />
worlds.  The &quot;primary&quot; question is whether or not this should be done to<br />
begin with; if it fails, then everything else is moot.  If it passes, on<br />
the other hand, then the plurality on any secondary question(s) would allow<br />
us to simultaneously and efficiently decide *how* it should be implemented<br />
without having to create separate proposals or cause the support vote to<br />
become split (since your vote(s) to any secondary questions would have no<br />
bearing on your primary question vote).<br />
<br />
For example, let's time-travel ten years into the future.  I wanted to<br />
modify PHP 7.3's configure script to use a botnet I control to increase<br />
PHP's processing power (as of PHP 7, PHP can exploit rootkits but it can't<br />
control entire botnets).  If enabled, the RFC argues, I'd be able to<br />
increase my spam output tenfold and still have enough victim machines to<br />
carry out a DoS attack against FaceGoo+ (yep, they merged) and silence my<br />
many enemies.  But then, there a serious problem surrounding this proposal<br />
that someone raises:  Should there be a switch to activate this or should<br />
it simply be configure's default behavior?  Also, should this include a<br />
switch that instructs PHP to install a rootkit on vulnerable systems<br />
automatically, and if so, should we integrate that with the main switch,<br />
make it a separate switch, or just make it the default behavior as well?<br />
<br />
Naturally, this would best be handled as a single RFC.  The &quot;primary&quot;<br />
question would be something along the lines of, &quot;Should PHP's built-in<br />
trojan management capabilities be expanded to allow for control of large<br />
botnets (yes/no)?&quot;<br />
<br />
Then, there would be some secondary questions; for each one, the prefix &quot;If<br />
implemented....&quot; is assumed:  &quot;Should the the switch be enabled by default<br />
(yes/no),&quot; &quot;How should rootkit install toggling be handled (option on main<br />
switch/separate switch/just make it default),&quot; and, &quot;Should we commit<br />
another series of arsons at Semantic in order to slow the development of<br />
new security patches that might hinder our supreme objective?&quot;<br />
<br />
<br />
Heh sorry, my examples tend to get a bit psychotic after a long day at<br />
work.  But you have the gist of it, at least.  ;)<br />
<br />
--Kris<br />
<br />
<br />
On Wed, Feb 29, 2012 at 6:32 PM, Richard Lynch &lt;ceo@l-i-e.com&gt; wrote:<br />
<br />
&gt; On Wed, February 29, 2012 6:55 pm, Kris Craig wrote:<br />
&gt; &gt; If not, I'll go ahead and draft an RFC for these proposed amendments<br />
&gt; &gt; sometime today or tomorrow when I get a spare moment.  If anyone has<br />
&gt; &gt; any<br />
&gt; &gt; thoughts on this, please share them!  Thanks!<br />
&gt;<br />
&gt; This is not an official answer. I don't have time to dig out references.<br />
&gt;<br />
&gt; I believe the PHP community settled on the idea of having a single<br />
&gt; simple pass / fail vote without the complexity of branches / options.<br />
&gt;<br />
&gt; It was simply to hard to tally the votes once you open up the options,<br />
&gt; because your support base ends up being split.<br />
&gt;<br />
&gt; NOTE: See current  US Republican Primaries for examples of how complex<br />
&gt; it gets. :-)<br />
&gt;<br />
&gt; There is nothing to stop one from drafting multiple proposals, with<br />
&gt; alternative options, and each one getting vote upon, other than the<br />
&gt; time available to the person drafting the proposals.<br />
&gt;<br />
&gt; And, of course, a reasonable expectation that with TOO many proposals<br />
&gt; of the same idea, the community would quickly turn into robo-voting,<br />
&gt; both for and against, as that's just human nature.<br />
&gt;<br />
&gt; Again, I say, I don't claim to speak for the whole community.  This is<br />
&gt; merely my interpretation from my faulty memory of past events.<br />
&gt;<br />
&gt; --<br />
&gt; brain cancer update:<br />
&gt; <a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
&gt; Donate:<br />
&gt;<br />
&gt; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
&gt;<br />
&gt;<br />
&gt;<br />
&gt; --<br />
&gt; PHP Internals - PHP Runtime Development Mailing List<br />
&gt; To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a><br />
&gt;<br />
&gt;]]></description>
            <dc:creator>Kris Craig</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 04:20:24 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454157#msg-454157</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454157#msg-454157</link>
            <description><![CDATA[ On Wed, February 29, 2012 6:55 pm, Kris Craig wrote:<br />
&gt; If not, I'll go ahead and draft an RFC for these proposed amendments<br />
&gt; sometime today or tomorrow when I get a spare moment.  If anyone has<br />
&gt; any<br />
&gt; thoughts on this, please share them!  Thanks!<br />
<br />
This is not an official answer. I don't have time to dig out references.<br />
<br />
I believe the PHP community settled on the idea of having a single<br />
simple pass / fail vote without the complexity of branches / options.<br />
<br />
It was simply to hard to tally the votes once you open up the options,<br />
because your support base ends up being split.<br />
<br />
NOTE: See current  US Republican Primaries for examples of how complex<br />
it gets. :-)<br />
<br />
There is nothing to stop one from drafting multiple proposals, with<br />
alternative options, and each one getting vote upon, other than the<br />
time available to the person drafting the proposals.<br />
<br />
And, of course, a reasonable expectation that with TOO many proposals<br />
of the same idea, the community would quickly turn into robo-voting,<br />
both for and against, as that's just human nature.<br />
<br />
Again, I say, I don't claim to speak for the whole community.  This is<br />
merely my interpretation from my faulty memory of past events.<br />
<br />
-- <br />
brain cancer update:<br />
<a href="http://richardlynch.blogspot.com/search/label/brain%20tumor" target="_blank"  rel="nofollow">http://richardlynch.blogspot.com/search/label/brain%20tumor</a><br />
Donate:<br />
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE" target="_blank"  rel="nofollow">https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=FS9NLTNEEKWBE</a><br />
<br />
<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>Richard Lynch</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 03:41:24 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454141#msg-454141</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454141#msg-454141</link>
            <description><![CDATA[ On Wed, Feb 29, 2012 at 8:46 PM, Kris Craig &lt;kris.craig@gmail.com&gt; wrote:<br />
<br />
&gt; I was thinking something more along the lines of simply throwing an error<br />
&gt; if, say, (int) $a != $a.... *if *$a is defined as an integer.<br />
&gt;<br />
&gt; --Kris<br />
&gt;<br />
&gt;<br />
&gt; On Wed, Feb 29, 2012 at 5:16 PM, John Crenshaw &lt;johncrenshaw@priacta.com<br />
&gt; &gt;wrote:<br />
&gt;<br />
&gt; &gt; &gt; -----Original Message-----<br />
&gt; &gt; &gt; From: Kris Craig [mailto:kris.craig@gmail.com]<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; @Richard I think you made a very good point.  Should we treat a float<br />
&gt; =&gt;<br />
&gt; &gt; int mismatch the same as we would a string =&gt; int mismatch, or should the<br />
&gt; &gt; former fail more gracefully?  I can see good arguments for both.<br />
&gt; &gt; &gt;<br />
&gt; &gt; &gt; --Kris<br />
&gt; &gt;<br />
&gt; &gt; I'm beginning to think that the type hinting question is too closely<br />
&gt; &gt; related to the dirty secrets of type juggling to resolve them separately.<br />
&gt; &gt; You may have to either discard consistency, or else fix the problem of<br />
&gt; &gt; silent bizarre conversions at the same time ('foo'==0, '123abc'=123).<br />
&gt; &gt; Fixing the conversions is a BC break though.<br />
&gt; &gt;<br />
&gt; &gt; John Crenshaw<br />
&gt; &gt; Priacta, Inc.<br />
&gt; &gt;<br />
&gt;<br />
<br />
John raises some real concerns about the relation of hinting and juggling.<br />
I'm wondering about allowing developers to declare type intentions (I'll<br />
post an idea in a separate thread.)<br />
<br />
Adam]]></description>
            <dc:creator>Adam Jon Richardson</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 03:00:43 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454138#msg-454138</guid>
            <title>Re: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454138#msg-454138</link>
            <description><![CDATA[ I was thinking something more along the lines of simply throwing an error<br />
if, say, (int) $a != $a.... *if *$a is defined as an integer.<br />
<br />
--Kris<br />
<br />
<br />
On Wed, Feb 29, 2012 at 5:16 PM, John Crenshaw &lt;johncrenshaw@priacta.com&gt;wrote:<br />
<br />
&gt; &gt; -----Original Message-----<br />
&gt; &gt; From: Kris Craig [mailto:kris.craig@gmail.com]<br />
&gt; &gt;<br />
&gt; &gt; @Richard I think you made a very good point.  Should we treat a float =&gt;<br />
&gt; int mismatch the same as we would a string =&gt; int mismatch, or should the<br />
&gt; former fail more gracefully?  I can see good arguments for both.<br />
&gt; &gt;<br />
&gt; &gt; --Kris<br />
&gt;<br />
&gt; I'm beginning to think that the type hinting question is too closely<br />
&gt; related to the dirty secrets of type juggling to resolve them separately.<br />
&gt; You may have to either discard consistency, or else fix the problem of<br />
&gt; silent bizarre conversions at the same time ('foo'==0, '123abc'=123).<br />
&gt; Fixing the conversions is a BC break though.<br />
&gt;<br />
&gt; John Crenshaw<br />
&gt; Priacta, Inc.<br />
&gt;]]></description>
            <dc:creator>Kris Craig</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 02:50:27 +0100</pubDate>
        </item>
        <item>
            <guid>http://www.serverphorums.com/read.php?7,451812,454124#msg-454124</guid>
            <title>RE: [PHP-DEV] Scalar type hinting</title>
            <link>http://www.serverphorums.com/read.php?7,451812,454124#msg-454124</link>
            <description><![CDATA[ &gt; -----Original Message-----<br />
&gt; From: Kris Craig [mailto:kris.craig@gmail.com] <br />
&gt;<br />
&gt; @Richard I think you made a very good point.  Should we treat a float =&gt; int mismatch the same as we would a string =&gt; int mismatch, or should the former fail more gracefully?  I can see good arguments for both.<br />
&gt;<br />
&gt; --Kris<br />
<br />
I'm beginning to think that the type hinting question is too closely related to the dirty secrets of type juggling to resolve them separately. You may have to either discard consistency, or else fix the problem of silent bizarre conversions at the same time ('foo'==0, '123abc'=123). Fixing the conversions is a BC break though.<br />
<br />
John Crenshaw<br />
Priacta, Inc.<br />
<br />
-- <br />
PHP Internals - PHP Runtime Development Mailing List<br />
To unsubscribe, visit: <a href="http://www.php.net/unsub.php" target="_blank"  rel="nofollow">http://www.php.net/unsub.php</a>]]></description>
            <dc:creator>John Crenshaw</dc:creator>
            <category>php-internals</category>
            <pubDate>Thu, 01 Mar 2012 02:21:24 +0100</pubDate>
        </item>
    </channel>
</rss>
