Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105780 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 92946 invoked from network); 23 May 2019 19:24:59 -0000 Received: from unknown (HELO xdebug.org) (82.113.146.227) by pb1.pair.com with SMTP; 23 May 2019 19:24:59 -0000 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 5632610C841; Thu, 23 May 2019 17:32:55 +0100 (BST) Date: Thu, 23 May 2019 17:32:55 +0100 (BST) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: Nikita Popov cc: Scott Dutton , PHP internals In-Reply-To: Message-ID: References: <4bdc84d133912367ab9d5139f37f9a6e@exussum.co.uk> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [PHP-DEV] [RFC] Base convert changes From: derick@php.net (Derick Rethans) On Thu, 23 May 2019, Nikita Popov wrote: > On Sat, May 18, 2019 at 11:22 AM Scott Dutton wrote: > > > I have made some changes to base_convert which I feel would be more > > consistent with the current PHP (warning when there are errors, and > > not just returning the best value it can) > > > > The RFC has some examples of what will change. > > > > Currently the code works but a lot of tests fail due to extreme > > range's (also mentioned in the RFC) > > > > If this passes I will fix the effected tests and add some more > > covering the new behavior. > > > > https://wiki.php.net/rfc/base_convert_improvements > > I definitely agree with the part of the RFC that warns on garbage > characters in the string. I'm not so sure about the changes in sign > handling. The problem I see is that certain bases (in particular hex) are > pretty much never used with an explicit sign, instead they are understood > to be in two's complement representation. > > For example, code like this will currently work: > > var_dump(dechex(0xffffffff00000000)); > // string(16) "ffffffff00000000" I concur with Nikita here. I don't think you should change the sign handling. I think this is something that actually use in real life projects. cheers, Derick -- https://derickrethans.nl | https://xdebug.org | https://dram.io Like Xdebug? Consider a donation: https://xdebug.org/donate.php, or become my Patron: https://www.patreon.com/derickr twitter: @derickr and @xdebug