Re: [PHP-DEV] An BC issue in unserialize

2014-07-17 Thread Stas Malyshev
Hi! in such case, the serialized data could be shared by 5.5 and 5.6... This is true, but what you presented is not serialized data. Serialized data will be fine. But the code you shown instead tries to use serializer as a roundabout way of instantiating objects. This is not the right

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Andrea Faulds
On 17 Jul 2014, at 04:23, Sara Golemon poll...@php.net wrote: Do we need a new operator for that? It feels un-php to me, and the kind of problem bigint objects should be meant to solve. On the other hand, having $a/$b != $a/$b (Off by more than 100 in this instance). But back on the first

Re: [PHP-DEV] crypt() BC issue

2014-07-17 Thread Tjerk Meesters
On Thu, Jul 17, 2014 at 10:25 AM, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi Tjerk, On Thu, Jul 17, 2014 at 11:09 AM, Tjerk Meesters tjerk.meest...@gmail.com wrote: Why should `password_verify()` work on a hash that wasn't generated with `password_hash()`? The fact that it uses `crypt()`

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Andrea Faulds
On 17 Jul 2014, at 01:11, Bishop Bettini bis...@php.net wrote: As another contender, how about: $x = 242 %/ 7; $x %/= 13; The % reflects the relationship to modulus, while the / reflects the division effect. I think %/ looks worse, but I think it seems more apropos. I also quite

RE: [PHP-DEV] An BC issue in unserialize

2014-07-17 Thread Zeev Suraski
-Original Message- From: Stas Malyshev [mailto:smalys...@sugarcrm.com] Sent: Thursday, July 17, 2014 9:08 AM To: Laruence; Remi Collet Cc: PHP Internals Subject: Re: [PHP-DEV] An BC issue in unserialize Hi! in such case, the serialized data could be shared by 5.5 and 5.6...

RE: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Zeev Suraski
-Original Message- From: Andrea Faulds [mailto:a...@ajf.me] Sent: Wednesday, July 16, 2014 6:15 PM To: bis...@php.net Cc: PHP internals Subject: Re: [PHP-DEV] [RFC] intdiv() The RFC has been updated to v0.2. It now proposes a %% operator for integer division (with corresponding

RE: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Zeev Suraski
-Original Message- From: Kris Craig [mailto:kris.cr...@gmail.com] Sent: Thursday, July 17, 2014 6:02 AM To: Andrea Faulds Cc: Stas Malyshev; PHP internals Subject: Re: [PHP-DEV] [RFC] intdiv() On Tue, Jul 15, 2014 at 5:13 AM, Andrea Faulds a...@ajf.me wrote: Perhaps the RFC could

Re: [PHP-DEV] An BC issue in unserialize

2014-07-17 Thread Stas Malyshev
Hi! IMHO this isn't something we should change in a 2nd digit release, but on a major version, even if it wasn't documented. We don't have much option here. Keeping it leads to a remote triggerable segfaults. We've discussed this here just recently. This is a hack that does not work properly

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Andrea Faulds
On 17 Jul 2014, at 07:29, Zeev Suraski z...@zend.com wrote: From debating whether it's worth it to add a new function for an not-so-commonly-used-operation-to-say-the-least, we're now seriously considering adding a new language level operator? Really? Is it *really* not that common? I can

Re: [PHP-DEV] Re: Use of php_mt_rand() rather than php_rand()

2014-07-17 Thread Pierre Joye
On Thu, Jul 17, 2014 at 1:02 AM, Yasuo Ohgaki yohg...@ohgaki.net wrote: RFC for this is created. https://wiki.php.net/rfc/use-php_mt_rand New rand() function name is TBD. I cannot think of good name, but I like rand_system(). rand() may stay as it is now also. I have mixed feelings about

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Pierre Joye
Hi Andrea, On Thu, Jul 17, 2014 at 8:44 AM, Andrea Faulds a...@ajf.me wrote: On 17 Jul 2014, at 07:29, Zeev Suraski z...@zend.com wrote: From debating whether it's worth it to add a new function for an not-so-commonly-used-operation-to-say-the-least, we're now seriously considering adding a

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Andrea Faulds
On 17 Jul 2014, at 07:56, Pierre Joye pierre@gmail.com wrote: The rare cases where I had to do that, I relied on bcmath or gmp. Yes, I needed some extra ops to actually achieve what this RFC proposes but it is good enough. The new ops overloading for extension simplifies that a lot as

RE: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Zeev Suraski
-Original Message- From: Andrea Faulds [mailto:a...@ajf.me] Sent: Thursday, July 17, 2014 9:44 AM To: Zeev Suraski Cc: bis...@php.net; PHP internals Subject: Re: [PHP-DEV] [RFC] intdiv() On 17 Jul 2014, at 07:29, Zeev Suraski z...@zend.com wrote: From debating whether it's

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Andrea Faulds
On 17 Jul 2014, at 08:02, Zeev Suraski z...@zend.com wrote: I think it is, given I believe it's the first time people are asking for this after PHP's been out for almost two decades... As the RFC itself suggests, you can use the current division for most use cases, including the ones

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Stas Malyshev
Hi! * Time (actually pretty common in web apps, though we have a DateTime class) Admittedly, we're getting closer to the dreaded year 2038, but what does it actually mean to divide current Unix timestamp by 3 and why one would ever want to do this? We also have classes for real datetime

RE: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Zeev Suraski
-Original Message- From: Andrea Faulds [mailto:a...@ajf.me] Sent: Thursday, July 17, 2014 10:09 AM To: Zeev Suraski Cc: bis...@php.net; PHP internals Subject: Re: [PHP-DEV] [RFC] intdiv() On 17 Jul 2014, at 08:02, Zeev Suraski z...@zend.com wrote: I think it is, given I believe

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Lester Caine
On 17/07/14 04:23, Sara Golemon wrote: Wow. I just finally understood what your RFC was going for. I thought you were trying to cover the case where ($a%$b)==0, but you're not, you're trying to do truncated integer division regardless of remainder. I also missed the fact that div_function

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Andrea Faulds
On 17 Jul 2014, at 08:19, Zeev Suraski z...@zend.com wrote: PHP's not Perl. Let's keep it that way please… I don't think it makes sense to add a specialized integer division operator when we do have a different division operator, and I don't think other dynamic languages have such an

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Lester Caine
On 17/07/14 08:02, Zeev Suraski wrote: I think it is, given I believe it's the first time people are asking for this after PHP's been out for almost two decades... As the RFC itself suggests, you can use the current division for most use cases, including the ones mentioned above - they'd work

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Andrea Faulds
On 17 Jul 2014, at 08:17, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! * Time (actually pretty common in web apps, though we have a DateTime class) Admittedly, we're getting closer to the dreaded year 2038, but what does it actually mean to divide current Unix timestamp by 3 and why

Re: [PHP-DEV] An BC issue in unserialize

2014-07-17 Thread Marco Pivetta
On Thu, Jul 17, 2014 at 8:43 AM, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! IMHO this isn't something we should change in a 2nd digit release, but on a major version, even if it wasn't documented. We don't have much option here. Keeping it leads to a remote triggerable segfaults.

Re: [PHP-DEV] An BC issue in unserialize

2014-07-17 Thread Stas Malyshev
Hi! As discussed in previous threads about this failure, we (doctrine) can move away from the `unserialize()` hack if `ReflectionClass#newInstanceWithoutConstructor()` provides support for internal classes. Could you explain why it is needed to instantiate internal classes without calling

Re: [PHP-DEV] An BC issue in unserialize

2014-07-17 Thread Marco Pivetta
On Thu, Jul 17, 2014 at 9:58 AM, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! As discussed in previous threads about this failure, we (doctrine) can move away from the `unserialize()` hack if `ReflectionClass#newInstanceWithoutConstructor()` provides support for internal classes.

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Nikita Popov
On Thu, Jul 17, 2014 at 2:25 AM, Sara Golemon poll...@php.net wrote: On Wed, Jul 16, 2014 at 8:15 AM, Andrea Faulds a...@ajf.me wrote: Nikita Popov doesn’t seem to be a fan of the %% syntax, so it may be subject to change, though I think it’s the best I’ve heard so far. ;) Nor am I.

Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-17 Thread Thomas Nunninger
Hi, On 07/16/2014 10:45 PM, Andrea Faulds wrote: On 16 Jul 2014, at 21:43, Zeev Suraski z...@zend.com wrote: anything this RFC permits will be permitted by zpp, it's the reverse that isn't necessarily true. Right, so it needs to be fixed. It makes no sense to force a new agenda on the

[PHP-DEV] Fixing bug #66827

2014-07-17 Thread Yasuo Ohgaki
Hi all, https://github.com/php/php-src/pull/725 This is the fix for https://bugs.php.net/bug.php?id=66827 This kind of malformed data is an attack most likely, but raising error is not an option. Quick grep show no module nor core log error only. i.e. There is no error logging only code. All of

Re: [PHP-DEV] crypt() BC issue

2014-07-17 Thread Yasuo Ohgaki
Hi Tjerk, On Thu, Jul 17, 2014 at 3:16 PM, Tjerk Meesters tjerk.meest...@gmail.com wrote: On Thu, Jul 17, 2014 at 10:25 AM, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi Tjerk, On Thu, Jul 17, 2014 at 11:09 AM, Tjerk Meesters tjerk.meest...@gmail.com wrote: Why should `password_verify()`

Re: [PHP-DEV] Re: Use of php_mt_rand() rather than php_rand()

2014-07-17 Thread Yasuo Ohgaki
Hi Pierre, On Thu, Jul 17, 2014 at 3:52 PM, Pierre Joye pierre@gmail.com wrote: On Thu, Jul 17, 2014 at 1:02 AM, Yasuo Ohgaki yohg...@ohgaki.net wrote: RFC for this is created. https://wiki.php.net/rfc/use-php_mt_rand New rand() function name is TBD. I cannot think of good name,

RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-17 Thread Robert Stoll
-Original Message- From: Alain Williams [mailto:a...@phcomp.co.uk] Sent: Wednesday, July 16, 2014 11:17 AM To: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) On Wed, Jul 16, 2014 at 09:31:46AM +0100, Rowan Collins wrote: Now,

Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-17 Thread Dan Ackroyd
Thomas Nunninger wrote: - scalar parameter casting should just be a convenience for coding: function foo( (int) $i, (string) $s ) { } is the same as: function foo( $i, $s ) { $i = (int) $i; $s = (string) $s; } or perhaps better::

Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-17 Thread Thomas Nunninger
Hi Dan, On 07/17/2014 02:12 PM, Dan Ackroyd wrote: Thomas Nunninger wrote: - scalar parameter casting should just be a convenience for coding: function foo( (int) $i, (string) $s ) { } is the same as: function foo( $i, $s ) { $i = (int) $i;

RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-17 Thread Christian Stoller
- I'd like to have E_CAST on all castings/type jugglings even if we do not get scalar type hinting. $var = 6.3; $a = (int) $var; Or $b = (bool) 1; This is usual code and it could be wanted to losse information on casting. Triggering errors for that would be extremely annoying. - I

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Andrea Faulds
On 17 Jul 2014, at 10:24, Nikita Popov nikita@gmail.com wrote: This is already what is currently happening, see http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_operators.c#1067. Andreas proposal is only useful in the case that the numbers don't divide exactly and you need

Re: [PHP-DEV] crypt() BC issue

2014-07-17 Thread Adam Harvey
On 16 July 2014 23:16, Tjerk Meesters tjerk.meest...@gmail.com wrote: On Thu, Jul 17, 2014 at 10:25 AM, Yasuo Ohgaki yohg...@ohgaki.net wrote: Hi Tjerk, On Thu, Jul 17, 2014 at 11:09 AM, Tjerk Meesters tjerk.meest...@gmail.com wrote: Why should `password_verify()` work on a hash that

Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-17 Thread Dan Ackroyd
Hi Thomas, Perhaps I miss your point. But what is the difference to current behavior if you do not know about the types? Not to the current behaviour, to the behaviour that would be possible with scalar type-hinting. Or is your point about inspection of parameter type? Why shouldn't

Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-17 Thread Dan Ackroyd
Apologies, I pasted the wrong code, it should have read: which makes the code: function foo( $i, $s ) { $i = (int) $i; $s = (string) $s; } Not be equivalent to: function foo( (int) $i, (string) $s ) { } As the type-hint information is not

Re: [PHP-DEV] crypt() BC issue

2014-07-17 Thread Anthony Ferrara
All, Look at the issue, there's a line in there that is the crux of the issue: So problem isn't only in ROUNDS_MIN. In fact, the overall algorithm changed. Look at a quick example: http://3v4l.org/Eov3o From 5.3.2+ (when we pulled in our own implementation of crypt-sha256 and crypt-sha512,

[PHP-DEV] VCS Account Request: royopa

2014-07-17 Thread Rodrigo Prado de Jesus
Hi I want to help translating the PHP documentation. For some time I have contributed in PHP translation projects for Symfony2 (https://github.com/andreia/symfony-docs-pt-BR/), DBAL (https://github.com/royopa/dbal-documentation- en_US) and Silex Framework

Re: [PHP-DEV] crypt() BC issue

2014-07-17 Thread Yasuo Ohgaki
Hi all, On Fri, Jul 18, 2014 at 4:38 AM, Anthony Ferrara ircmax...@gmail.com wrote: We internalized the algorithms in 5.3.2 at least partially because the system provided libraries were inconsistent at best (hence why many but not all 5.2 systems don't support bcrypt, it depended on the build

Re: [PHP-DEV] crypt() BC issue

2014-07-17 Thread Anthony Ferrara
Yasuo Anthony, do you have suggestion for removing 72 char restriction of PASSWORD_BCRYPT? My suggestion is to leave it there (it's no longer bcrypt if you do something to remove it). Here's a deeper explanation: http://stackoverflow.com/a/16597402/338665 Once scrypt (or yescrypt, or whatever

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Kris Craig
On Thu, Jul 17, 2014 at 6:31 AM, Andrea Faulds a...@ajf.me wrote: On 17 Jul 2014, at 10:24, Nikita Popov nikita@gmail.com wrote: This is already what is currently happening, see http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_operators.c#1067. Andreas proposal is only useful in the

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Tjerk Meesters
On Fri, Jul 18, 2014 at 10:47 AM, Kris Craig kris.cr...@gmail.com wrote: On Thu, Jul 17, 2014 at 6:31 AM, Andrea Faulds a...@ajf.me wrote: On 17 Jul 2014, at 10:24, Nikita Popov nikita@gmail.com wrote: This is already what is currently happening, see

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Kris Craig
On Thu, Jul 17, 2014 at 8:39 PM, Tjerk Meesters tjerk.meest...@gmail.com wrote: On Fri, Jul 18, 2014 at 10:47 AM, Kris Craig kris.cr...@gmail.com wrote: On Thu, Jul 17, 2014 at 6:31 AM, Andrea Faulds a...@ajf.me wrote: On 17 Jul 2014, at 10:24, Nikita Popov nikita@gmail.com wrote:

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Tjerk Meesters
On Fri, Jul 18, 2014 at 12:04 PM, Kris Craig kris.cr...@gmail.com wrote: On Thu, Jul 17, 2014 at 8:39 PM, Tjerk Meesters tjerk.meest...@gmail.com wrote: On Fri, Jul 18, 2014 at 10:47 AM, Kris Craig kris.cr...@gmail.com wrote: On Thu, Jul 17, 2014 at 6:31 AM, Andrea Faulds a...@ajf.me

Re: [PHP-DEV] [RFC] intdiv()

2014-07-17 Thread Kris Craig
On Thu, Jul 17, 2014 at 9:18 PM, Tjerk Meesters tjerk.meest...@gmail.com wrote: On Fri, Jul 18, 2014 at 12:04 PM, Kris Craig kris.cr...@gmail.com wrote: On Thu, Jul 17, 2014 at 8:39 PM, Tjerk Meesters tjerk.meest...@gmail.com wrote: On Fri, Jul 18, 2014 at 10:47 AM, Kris Craig

Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)

2014-07-17 Thread Theodore Brown
Since I am very much in favour of scalar type hints, I've updated the patch to master and made some minor improvements, and I am re-opening the RFC with the intent to try and get it into PHP 5.7. First of all, this is my first reply on PHP Internals so I hope I am doing it right. :) Thank