Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94959 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41511 invoked from network); 8 Aug 2016 22:12:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2016 22:12:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@daveyshafik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@daveyshafik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain daveyshafik.com from 209.85.220.180 cause and error) X-PHP-List-Original-Sender: me@daveyshafik.com X-Host-Fingerprint: 209.85.220.180 mail-qk0-f180.google.com Received: from [209.85.220.180] ([209.85.220.180:34326] helo=mail-qk0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/FB-33134-2C309A75 for ; Mon, 08 Aug 2016 18:12:18 -0400 Received: by mail-qk0-f180.google.com with SMTP id p186so210517160qkd.1 for ; Mon, 08 Aug 2016 15:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daveyshafik-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=uLB/Q2hQ6DZqSljcaxLWUR/I/20FDHFHxnaOomJW2bc=; b=JNItGjxrhDN7MtwlcD+V27WAGRSed4dv5F2rXvhjGVmhiflpVr33ncNwDt04yGsxQ1 Ijapohi/ni0MWoUQOrTca9CgEA9z3HjUTBfC16wnfn2c+all0p6Jf7M8K1qsvkKLSjua 95pQ1Pv8a64H6q5VJTaYk5uCK1ZWAP4yVYX7j2K5ZBldD9J5+RtSRtU+YWVZGFfbiBFN ctduxetToUmw+whwGSbU+DrQDKlufTZKByirmvLKTN2Ww6CfBWw2as/v0Ghxt6X/Rgsu /G8a+AeTb++TsW59tNjAuXS0bVnWOHLiDdx+YVZQs9TN3sopAOSeLSWgSZOWU/iHV8PH YeYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=uLB/Q2hQ6DZqSljcaxLWUR/I/20FDHFHxnaOomJW2bc=; b=fsANrL5HQTflvqFxzadkieQJLWLqkKS7XzJixCF2Wic4Xk6PtmFiZ+/oxkiWfXHEmD UQjBCAHKjCjh2DPSad9+ATgz2oDwet7+ZTKlGKaxsrIGzDUFQ265oyYzVtd6NOMhOb3R DyetN6UesjLGXTENr3RtpYAZM0cz6rjZD3fIYjcWKkZF1PhmOempGvRxenfPySLroPrx tqYOoFJQ/ZfXtJfcdAfmODLELUM5rARNlV+0CjTKNXx/tDRNGSialIwf60dKQeVak66s 7t/W5LqEx+4jpDAwWm/SUauhvfp2xxbijcIRH7MzLZlBPWwbrpT2VhXL2QCHzQUIn5Aa by1g== X-Gm-Message-State: AEkoouswmvR5EoX+Al+tnNKGZ3rFsbbcgplLmacJ12dYUenWQK8gC690JfG60s9SuTAKHvWqmDb33ItPGeBHtyGz X-Received: by 10.55.155.140 with SMTP id d134mr32352581qke.145.1470694334769; Mon, 08 Aug 2016 15:12:14 -0700 (PDT) MIME-Version: 1.0 Sender: me@daveyshafik.com Received: by 10.237.55.138 with HTTP; Mon, 8 Aug 2016 15:12:14 -0700 (PDT) In-Reply-To: References: Date: Mon, 8 Aug 2016 15:12:14 -0700 X-Google-Sender-Auth: LLB_iXs1VkLYoXcHJh8hyaigDe4 Message-ID: To: Leigh Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=94eb2c0603b265d872053996b53b Subject: Re: [PHP-DEV] BC break with rand() where min > max From: davey@php.net (Davey Shafik) --94eb2c0603b265d872053996b53b Content-Type: text/plain; charset=UTF-8 Leigh, I would _very_ much prefer to keep this BC. If we do the right thing, and there are no repercussions, I'd actually remove the warning. If you think we might want to disallow this in the future, use an E_DEPRECATED, but a warning seems pointless unless it's doing the wrong thing, or it's going to start doing the wrong thing at some point. - Davey On Mon, Aug 8, 2016 at 2:36 PM, Leigh wrote: > Hi all, > > There has been an unforeseen break with rand() when the minimum value is > greater than the maximum. > > Prior to 7.1 rand() would happily accept backwards parameters and return a > value, however in the 7.1 branch it now emits a warning and returns false. > > I've preemptively committed a fix to allow min > max and return a value as > in previous versions, but have kept the warning. > > Looking for some feedback/opinions on whether anyone else thinks this > should be fixed differently (or not at all). > > N.B. this also changes the behaviour of mt_rand to now accept min > max > --94eb2c0603b265d872053996b53b--