Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-02 Thread Simon Schick
Hi, Kris I have to confirm that that's not really what I wanted. But many people were now talking about type-hint to scalar, but that was maybe in another thread in this list :) To get more to the point what were discussing about want: Why not always (at least try) to transform the data? In PHP

Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-02 Thread Simon Schick
Hi, All Let me update my last functions as I got an inspiration from Anthony and his proof-of-concept: foo( (boolean) $b, (integer) $i, (float) $f, (string) $s) { // your code } foo2($b, $i, $f, $s) { $b = (boolean)$b; $i = (integer)$i; $f = (float)$f; $s = (string)$s; // your code

Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-02 Thread Ronald Chmara
On Thu, Mar 1, 2012 at 4:18 PM, John Crenshaw johncrens...@priacta.com wrote: 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

RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread John Crenshaw
You might consider those scripts poor programming practice. We all do. But PHP is the language of the unwashed masses, and that was, and is, part of why it is hugely popular. Somebody who barely understands programming can pound away at the keyboard and write a bloody useful web

RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread Arvids Godjuks
Secure code is not about the instrument, it's about how you write it. Insecure spagetti code can be written in any language.

RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread John Crenshaw
From: Richard Lynch [mailto:c...@l-i-e.com] On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote: 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,

Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread Simon Schick
Hi, John Just to add an idea to yours .. 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? No break at all, just a E_NOTICE or E_WARNING as the script can succeed anyways.

RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread John Crenshaw
From: Simon Schick [mailto:simonsimc...@googlemail.com] Hi, John Just to add an idea to yours .. 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? No break at

Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread Pierre Joye
If any of you are interested in such change in PHP, please get together and write a complete RFC. As I do not see any kind of progress but, as you stated, some philosophical discussions. That's all good but after 2 weeks, it is time to move forward (or stop). Cheers, On Thu, Mar 1, 2012 at 4:02

Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread Lazare Inepologlou
That's what I was calling inconsistent, 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

Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread jpauli
On Thu, Mar 1, 2012 at 9:52 AM, Simon Schick simonsimc...@googlemail.comwrote: Hi, John Just to add an idea to yours .. 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

RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread John Crenshaw
From: Richard Lynch [mailto:c...@l-i-e.com] On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote: 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

RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread Richard Lynch
On Thu, March 1, 2012 2:38 am, John Crenshaw wrote: You might consider those scripts poor programming practice. We all do. But PHP is the language of the unwashed masses, and that was, and is, part of why it is hugely popular. Somebody who barely understands programming can pound away at the

Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread Simon Schick
Hi, John Therefore I think it would be easy to explain how a type-hint for scalar could work. 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: function foo_one(scalar $bar) {} function foo_two($bar) { if

RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread John Crenshaw
From: Simon Schick [mailto:simonsimc...@googlemail.com] Hi, John Therefore I think it would be easy to explain how a type-hint for scalar could work. 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:

RE: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread John Crenshaw
From: Richard Lynch [mailto:c...@l-i-e.com] On Thu, March 1, 2012 2:38 am, John Crenshaw wrote: You might consider those scripts poor programming practice. We all do. But PHP is the language of the unwashed masses, and that was, and is, part of why it is hugely popular. Somebody who

Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-03-01 Thread Kris Craig
I agree with what John said. Limiting the scope to scalars, while having some advantages, probably wouldn't pass the usefulness test for most people. --Kris On Thu, Mar 1, 2012 at 4:18 PM, John Crenshaw johncrens...@priacta.comwrote: From: Richard Lynch [mailto:c...@l-i-e.com] On Thu,

Re: [PHP-DEV] PHP Philosophy (was RE: [PHP-DEV] Scalar type hinting)

2012-02-29 Thread Kris Craig
I agree with your well-thought-out remarks overall. However (and you knew a however was coming lol), by making these types optional, we would be allowing full backwards-compatibility without alienating non-CS developers, since they would be able to continue writing the same code they do now.