Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-03-02 Thread Lester Caine
On 02/03/15 09:47, Zeev Suraski wrote: I'm obviously biased but I believe that the coercive rules actually cover a lot more ground than the weak+strict sets. In other words, with weak+strict, overall, you're going to have to add custom code in a lot more cases than with the coercive rule set

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-03-02 Thread Zeev Suraski
-Original Message- From: Lester Caine [mailto:les...@lsces.co.uk] Sent: Monday, March 02, 2015 12:10 PM To: Zeev Suraski Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC On 02/03/15 09:47, Zeev Suraski wrote: I'm obviously

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-03-02 Thread Zeev Suraski
-Original Message- From: Thomas Punt [mailto:tp...@hotmail.co.uk] Sent: Sunday, March 01, 2015 4:03 PM To: Zeev Suraski; PHP internals Subject: RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC Hey Zeev, Another change being considered and not yet in the RFC

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-03-02 Thread Zeev Suraski
-Original Message- From: Lester Caine [mailto:les...@lsces.co.uk] Sent: Monday, March 02, 2015 11:31 AM To: internals@lists.php.net Subject: Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC Andrea's post highlights the fact that we did try a fix when PHP5 came

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-03-02 Thread Lester Caine
On 02/03/15 08:39, Zeev Suraski wrote: One scenario I have in mind for this is validating $_GET information for a RESTful web service. Having potentially an infinite number of URIs that all point to the same resource isn't good: /users/1 /users/%201 /users/1%20 /users/%201%20

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-03-01 Thread Thomas Punt
Hey Zeev, Another change being considered and not yet in the RFC is re-allowing leading and trailing spaces for numeric strings (sorry Paddy.) I think that rejecting leading and trailing spaces for stringy ints is for the best. If I only want to accept an integer (in either int or string

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-28 Thread François Laupretre
De : Brian Moon [mailto:br...@moonspot.net] I agree here with Benjamin. The thing I have wanted in user land for years is to be able to build a user land function that worked the way internal functions do in terms of type checking without having to build my own type checking system. Having

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-28 Thread François Laupretre
De : Damien Tournoud [mailto:d...@damz.org] All those are due to a bug in substr(), that we see now only thanks to proper type identification. There is no reason for substr() to ever return a boolean. It really needs to be fix to always return a string. Sorry, not a bug. Documentation is

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-28 Thread Lester Caine
On 28/02/15 08:40, François Laupretre wrote: My opinion, but that's only mine, is that I would favor deprecating null to scalar, even for internal functions. It would add deprecation messages but we'd end up with a cleaner code. null is a very specific 'state' for anybody working with

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-28 Thread François Laupretre
De : Benjamin Eberlei [mailto:kont...@beberlei.de] The funny thing is that the fix for this is: - substr($image, strrpos($image, \n) + 1) + (string)substr($image, strrpos($image, \n) + 1) Which is that sort of casting that is put forward as argument against the dual/strict mode. It is

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-28 Thread François Laupretre
De : Benjamin Eberlei [mailto:kont...@beberlei.de] Interestingly functions like is_infinite(), is_dir(), is_file() all expect correct types like float or string here although from the naming convention is_something i would expect it says just false on *anything* else (which it almost does

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-28 Thread François Laupretre
De : Damien Tournoud [mailto:d...@damz.org] But anyway, that's not even the point. The point is that return values that worked in a world of transparent type-jungling will not work in a world of stricter typing checks. Which means that we need: (1) To accept that for now casting FALSE to

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-28 Thread Lester Caine
On 28/02/15 08:24, François Laupretre wrote: Sorry, not a bug. Documentation is clear. You get 'string|false' from substr() and send it to a function expecting 'string'. Most languages will fail on this. It worked in PHP because of implicit casting from bool to string. We just decided to

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Damien Tournoud
Hi Christian, On Fri, Feb 27, 2015 at 5:15 PM, Christian Stoller stol...@leonex.de wrote: In this case FALSE is an expected result and it is intended. And as I said other languages are going the same way. Other languages are also doing something saner. It's not really an argument either way.

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Brian Moon
This RFC trying to simpliy and cleanup the coercison rules, having two different conversion rules for NULL-scalar depending on userland or internal is counter-productive and bad. The behavior you describe as null being empty value is wide-spread in PHP userland code as well. I agree here with

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Lester Caine
On 27/02/15 14:15, Benjamin Eberlei wrote: Imho the problem is that the return values of php internal functions being string|false will lead to massive consecutive errors when passing this on to other internal functions. This is perhaps the crux of my objection to both types of 'error

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Lester Caine
On 27/02/15 16:46, Damien Tournoud wrote: You probably haven't read the examples that I pasted. If you think that it makes sense to return an error code if the function is called with invalid arguments, it should be done consistently. The current behavior is just an absurdly inconsistent, it

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Lester Caine
On 27/02/15 13:45, Benjamin Eberlei wrote: Drupal admin interface (across the all pages): One new E_DEPRECATED warning, which again seems to catch a real bug - stripslsahes() operating on a boolean. All those are due to a bug in substr(), that we see now only thanks to proper

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Benjamin Eberlei
On Fri, Feb 27, 2015 at 2:57 PM, Lester Caine les...@lsces.co.uk wrote: On 27/02/15 13:45, Benjamin Eberlei wrote: Drupal admin interface (across the all pages): One new E_DEPRECATED warning, which again seems to catch a real bug - stripslsahes() operating on a boolean.

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Christian Stoller
From: Damien Tournoud [mailto:d...@damz.org], Sent: Friday, February 27, 2015 2:38 PM Hi Zeev, On Fri, Feb 27, 2015 at 12:57 AM, Zeev Suraski z...@zend.com wrote: Drupal homepage: One new E_DEPRECATED warning, which seems to catch a real bug, or at least faulty looking code: $path =

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Benjamin Eberlei
On Fri, Feb 27, 2015 at 2:37 PM, Damien Tournoud d...@damz.org wrote: Hi Zeev, On Fri, Feb 27, 2015 at 12:57 AM, Zeev Suraski z...@zend.com wrote: Drupal homepage: One new E_DEPRECATED warning, which seems to catch a real bug, or at least faulty looking code: $path = trim($path,

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Zeev Suraski
-Original Message- From: Benjamin Eberlei [mailto:kont...@beberlei.de] Sent: Friday, February 27, 2015 1:19 PM To: Dmitry Stogov Cc: Zeev Suraski; PHP internals Subject: Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC On Fri, Feb 27, 2015 at 9:44 AM, Dmitry

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Damien Tournoud
Hi Zeev, On Fri, Feb 27, 2015 at 12:57 AM, Zeev Suraski z...@zend.com wrote: Drupal homepage: One new E_DEPRECATED warning, which seems to catch a real bug, or at least faulty looking code: $path = trim($path, '/'); // raises E_DEPRECATED, as $path is boolean false. return $path;

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Benjamin Eberlei
On Fri, Feb 27, 2015 at 2:37 PM, Damien Tournoud d...@damz.org wrote: Hi Zeev, On Fri, Feb 27, 2015 at 12:57 AM, Zeev Suraski z...@zend.com wrote: Drupal homepage: One new E_DEPRECATED warning, which seems to catch a real bug, or at least faulty looking code: $path = trim($path,

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Christian Stoller
From: Damien Tournoud [mailto:d...@damz.org], Sent: Friday, February 27, 2015 4:54 PM Hi Christian, On Fri, Feb 27, 2015 at 3:38 PM, Christian Stoller stol...@leonex.de wrote: It is not a bug. FALSE as a return value of substr() is the identificator for an error (e.g. invalid arguments), as

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Anthony Ferrara
Cristian, All those are due to a bug in substr(), that we see now only thanks to proper type identification. There is no reason for substr() to ever return a boolean. It really needs to be fix to always return a string. Damien It is not a bug. FALSE as a return value of substr() is the

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Damien Tournoud
Hi Christian, On Fri, Feb 27, 2015 at 3:38 PM, Christian Stoller stol...@leonex.de wrote: It is not a bug. FALSE as a return value of substr() is the identificator for an error (e.g. invalid arguments), as it is stated in the documentation: [...] It is documented that way and it is not a

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Damien Tournoud
Hi Lester, On Fri, Feb 27, 2015 at 6:51 PM, Lester Caine les...@lsces.co.uk wrote: This may not be what YOU want substr to do and it would perhaps be useful to ADD additional checks so that 'false' is returned when it can't created a string because of the 'invalid arguments', but type hints

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Lester Caine
On 27/02/15 20:28, Damien Tournoud wrote: Hi Lester, On Fri, Feb 27, 2015 at 6:51 PM, Lester Caine les...@lsces.co.uk mailto:les...@lsces.co.uk wrote: This may not be what YOU want substr to do and it would perhaps be useful to ADD additional checks so that 'false' is returned

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Benjamin Eberlei
Zeev, On Fri, Feb 27, 2015 at 12:57 AM, Zeev Suraski z...@zend.com wrote: All, We've been working in the last few days to test and tune the Coercive STH patch. I think the results are quite nice, and surprisingly better than one might have expected. Can we try the patch ourselves? I

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Damien Tournoud
Hi Lester, On Fri, Feb 27, 2015 at 9:53 PM, Lester Caine les...@lsces.co.uk wrote: Please, read the examples again, the current behavior is nothing but inconsistent: substr(a, 1) = FALSE substr(a, -300) = ? That was the case prior to PHP5.2.1 The fixes in 5.2.2 were not

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Dmitry Stogov
I've added the link to the patch https://github.com/php/php-src/pull/1125/files Thanks. Dmitry. On Fri, Feb 27, 2015 at 11:03 AM, Benjamin Eberlei kont...@beberlei.de wrote: Zeev, On Fri, Feb 27, 2015 at 12:57 AM, Zeev Suraski z...@zend.com wrote: All, We've been working in the last

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Benjamin Eberlei
On Fri, Feb 27, 2015 at 9:44 AM, Dmitry Stogov dmi...@zend.com wrote: I've added the link to the patch https://github.com/php/php-src/pull/1125/files Thanks! First, the necessary PHPUnit changes (dev-master) to avoid errors: https://gist.github.com/beberlei/8a33ae940829f1186da2 - Doctrine

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Larry Garfield
On 2/27/15 10:15 AM, Christian Stoller wrote: From: Damien Tournoud [mailto:d...@damz.org], Sent: Friday, February 27, 2015 4:54 PM Hi Christian, On Fri, Feb 27, 2015 at 3:38 PM, Christian Stoller stol...@leonex.de wrote: It is not a bug. FALSE as a return value of substr() is the

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Lester Caine
On 27/02/15 21:14, Damien Tournoud wrote: Hi Lester, On Fri, Feb 27, 2015 at 9:53 PM, Lester Caine les...@lsces.co.uk mailto:les...@lsces.co.uk wrote: Please, read the examples again, the current behavior is nothing but inconsistent: substr(a, 1) = FALSE

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-27 Thread Benjamin Eberlei
On Fri, Feb 27, 2015 at 12:18 PM, Benjamin Eberlei kont...@beberlei.de wrote: On Fri, Feb 27, 2015 at 9:44 AM, Dmitry Stogov dmi...@zend.com wrote: I've added the link to the patch https://github.com/php/php-src/pull/1125/files Thanks! First, the necessary PHPUnit changes (dev-master)

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-26 Thread François Laupretre
Hi Pierre, De : Pierre Joye [mailto:pierre@gmail.com] Also I would really like a clear table describing in details what will be changed, to compare how it works now and how it work later. The RFC now contains a table listing the changes compared to current PHP 5 rules. Enjoy it.

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-26 Thread Zeev Suraski
How many deprecations do you get running the ZF2 and Symfony testsuites? None, but it may have to do with the fact I haven't run them yet :) Zeev -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-26 Thread Pierre Joye
On Thu, Feb 26, 2015 at 3:57 PM, Zeev Suraski z...@zend.com wrote: Drupal homepage: One new E_DEPRECATED warning, which seems to catch a real bug, or at least faulty looking code: $path = trim($path, '/'); // raises E_DEPRECATED, as $path is boolean false. return $path; So far nobody

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-26 Thread Nikita Popov
On Fri, Feb 27, 2015 at 12:57 AM, Zeev Suraski z...@zend.com wrote: All, We've been working in the last few days to test and tune the Coercive STH patch. I think the results are quite nice, and surprisingly better than one might have expected. Before diving into the results, we did

Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-26 Thread Pádraic Brady
Hi Zeev, On 26 February 2015 at 23:57, Zeev Suraski z...@zend.com wrote: Another change being considered and not yet in the RFC is re-allowing leading and trailing spaces for numeric strings (sorry Paddy.) Not to worry. I know where Github keeps the servers ;). There are far worse things than

RE: [PHP-DEV] Coercive STH - some real world tests and updated RFC

2015-02-26 Thread François Laupretre
De : Pierre Joye [mailto:pierre@gmail.com] So far nobody answered this question but Francois (tried). You keep using this E_DEPRECATED message as a safety net to catch possible bad things. Yes, even if we don't really 'catch' things, because we just raise E_DEPRECATED and, then,