Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105499 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 79768 invoked from network); 29 Apr 2019 10:35:55 -0000 Received: from unknown (HELO mail-lj1-f178.google.com) (209.85.208.178) by pb1.pair.com with SMTP; 29 Apr 2019 10:35:55 -0000 Received: by mail-lj1-f178.google.com with SMTP id b12so7212531lji.4 for ; Mon, 29 Apr 2019 00:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6qS6cl/ubWAcKcUn17+L+T0xJQb5g8gTa7KT0pSxa5c=; b=Puee95uJqofUWjnqWnWkWcWLbGz0nIIJ69Zu4HUWnkgXoxLo1NP7QvTgAm+6Pi4EMq 1n6RRj+eFunkOChnvdie1I0MBXSHMSJ3uCsthAx8k9D+ivq1CJSE379ENPBSKJHPD83k rRLyFAo7SqGi1HwYbwIlKGtpcAWBQABEhgCFMjsymfYlxLrF9EwC43ya5wVyiWRHcnAS syiDxuJFBfsuVTDJR0TM1oUuvJ/ezhS1X5jQdBoeb314x9pR+LJGfH78XLzozwEnaFd+ 4UUqXSNng8l4M3k2yUaM3R4UrlB1VSn0lTFakYCkLH/d1ASZuq0ZIDY/l7OAXwsg69b/ qAVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6qS6cl/ubWAcKcUn17+L+T0xJQb5g8gTa7KT0pSxa5c=; b=KJ5Al5n/w34xFsGswovnaNd0az1RessvyHzXDPDDx/UVqKk2QrBMUqrA33LP8QjNZL ftC3+20vWzlkvhM88O20Qv9+LseDDQt4XUdKwoP08CW4SckppgBmkOcxUr2mzLdGa7yZ lL2DT/0XD9+URmrbOJ5BfRlZNwxNo+DbUXC55m1sGKd4Av6U+5nbmPJOoavr16M/1Lbf 3CabSkLMWlQ1O6YnMWc5y/Y4uNAgtBqayy3l8++NauqoSXm9adcqpXIdpMFB0wq19At6 8F394gO4yixvLeUM/Mb6abB7kd8QdsthVLAnljlhkDBzqXe+AUin8WG/Bq+mLEFn07I/ uv3A== X-Gm-Message-State: APjAAAUFV3tz8WonJYAtY9jyFiMb6y9KZsebTtKew9fXbhsPFNYo6AVm dE+7IPIWGXAAYeRfrYMb/qEErIqR/uE0Y2m1pjNhXogy X-Google-Smtp-Source: APXvYqw9ohy0c8vPYHKCpWyx5sLExzGCZpvQTZJ3pQu4qMbI2AzAVCtoX79nm4aDQkrz3CL/rvhBNhd0629h+FqgtoI= X-Received: by 2002:a2e:5ce:: with SMTP id 197mr2550838ljf.140.1556523465173; Mon, 29 Apr 2019 00:37:45 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 29 Apr 2019 09:37:28 +0200 Message-ID: To: Sara Golemon Cc: Gabriel Caruso , PHP Internals Content-Type: multipart/alternative; boundary="00000000000039f0690587a65cd6" Subject: Re: [PHP-DEV] Don't silence chr function arguments error From: nikita.ppv@gmail.com (Nikita Popov) --00000000000039f0690587a65cd6 Content-Type: text/plain; charset="UTF-8" On Mon, Apr 29, 2019 at 3:44 AM Sara Golemon wrote: > On Sun, Apr 28, 2019 at 6:05 PM Gabriel Caruso > wrote: > > > Currently, if you pass an argument that is not an integer, it will simply > > return an empty string: https://3v4l.org/FF2nA. > > > Not entirely accurate. It outputs a one-character string (the null byte). > > > > In case you pass more than > > 1 argument, it will complain about "Wrong number of arguments": > > https://3v4l.org/Yrr43. > > > > > > > > The proposal of https://github.com/php/php-src/pull/4080 is to relly > these > > checks to ZPP, making the first argument mandatory to an integer, and > make > > the error message for extra arguments consistent with the rest of the > core > > functions, e.g. "Warning: chr() expects parameter 1 to be int, string > > given". > > > > I'm actually perfectly in favor of raising a proper warning here. I > noticed the odd behavior when I was porting this function to HHVM and IIRC > I raised a discussion about it and the bottom line was "Let's not do this > because X", and I couldn't possibly tell you what X was. :( > The thread is out there somewhere though. > > > > The idea is to merge in PHP-7.4, but if there's a consensus that this > > should go into PHP 8 only, so it is :) > > > > Technically a BC break, so 8.0 would be the preferred branch IMO. > As this would be a TypeError on 8.0, I think it might make sense to introduce it in 7.4 where this is still a warning (and should keep the current "\0" return value in that case -- just make it throw a warning). Nikita --00000000000039f0690587a65cd6--