Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100961 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40946 invoked from network); 27 Oct 2017 11:22:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Oct 2017 11:22:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=lists@rhsoft.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lists@rhsoft.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain rhsoft.net designates 91.118.73.15 as permitted sender) X-PHP-List-Original-Sender: lists@rhsoft.net X-Host-Fingerprint: 91.118.73.15 mail.thelounge.net Received: from [91.118.73.15] ([91.118.73.15:19813] helo=mail.thelounge.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/5C-28573-8F613F95 for ; Fri, 27 Oct 2017 07:22:33 -0400 Received: from srv-rhsoft.rhsoft.net (Authenticated sender: h.reindl@thelounge.net) by mail.thelounge.net (THELOUNGE MTA) with ESMTPSA id 3yNhLD5VxqzXMj; Fri, 27 Oct 2017 13:22:28 +0200 (CEST) To: PHP Internals References: <7639e065-451b-0f2e-1985-5e3d31ec1b68@gmail.com> <45daf06e-e448-f3c9-5cbf-4f947c4db13f@rhsoft.net> Message-ID: Date: Fri, 27 Oct 2017 13:22:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-CH Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Raise E_NOTICE for null castings From: lists@rhsoft.net ("lists@rhsoft.net") Am 27.10.2017 um 12:54 schrieb Niklas Keller: > pleae don't break code like this which is a useful case for access > directly a array field returned from a function and so makes this to > a one-liner without check the result > > public function GetMaxSort(): int > { >  return (int)mysqli_fetch_row($this->cl_api->db->query("select > SQL_NO_CACHE max(hsort) from {$this->cl_api->sql_prefix}main", 1))[0]; > > } > > > Just use return (int) mysqli_fetch_row($this->cl_api->db->query("select > SQL_NO_CACHE max(hsort) from {$this->cl_api->sql_prefix}main", 1))[0] ?? 0; thanks - that's indeed the better solution and since i use MYSQLI_OPT_INT_AND_FLOAT_NATIVE in the database layer the complete type-casting can be removed too!