Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117818 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81389 invoked from network); 28 May 2022 15:05:38 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 28 May 2022 15:05:38 -0000 To: internals@lists.php.net Date: Sat, 28 May 2022 17:48:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Content-Language: en-GB References: <2B63A776-11B9-49BF-AE0A-FCF7F4E738F2@craigfrancis.co.uk> In-Reply-To: <2B63A776-11B9-49BF-AE0A-FCF7F4E738F2@craigfrancis.co.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 149.241.131.223 Subject: Re: NULL Coercion Consistency From: marandall@php.net (Mark Randall) Message-ID: On 28/05/2022 03:36, Craig Francis wrote: > In this case, two of my clients are considering the cost of modifying their code (by adding a load of `?? ''` everywhere), and they would rather avoid that (time consuming, and makes their code more complicated). Alternatively, they may wish to define their own functions that do take null and then run a find / replace or rector rule to convert them over. I would still recommend ?? because it's the most future proof. We have passed two RFCs in recent months which will eliminate default-nulls in 2 of the 3 major variable sources in the engine (the remaining one being arrays), and that too may eventually find itself promoted. If it's a framework, I would suggest adding methods for explicitly getting a string that defaults to '' instead of null.