Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51858 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31277 invoked from network); 11 Apr 2011 02:35:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Apr 2011 02:35:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=shadda@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=shadda@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: shadda@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:36007] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 53/60-29000-1E862AD4 for ; Sun, 10 Apr 2011 22:35:14 -0400 Received: by iyb12 with SMTP id 12so6413035iyb.29 for ; Sun, 10 Apr 2011 19:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=LjSuq7h1LCWz1Jul6wLsYleb28Bk5Xb6D/JEDwYqByE=; b=gr81/gpq8QLb1YVI6NFMkU3p76j/ihzePPkgiEh5IX62Cq8Dv4Hp75cTZ2Bhow+Krq d65bPp/wIGo+VPdUgx88r0oHLSA491IXNV0rPOqaVFxz8ZWRtnqdYa1CKGFuVq9WViKq +0qjbeubE/j73ohRughKF3yj3ADblM9kR/4zk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=T16idGPODPTGPL92Inofjg5y6F+bJInKq8oOPfEufiw9PdrQ/5E+nLIQIeY2Se4zdb 0neB0Qq8MpXsJSDhMTCaiDMheTwE//SwGE9h8DbAhDzzBv4QPT2l30TqgJrZ0DC8V5sE CKhkvk1SU8gkr44Ya4zzkViQgOSib3f7L6JoM= Received: by 10.42.130.138 with SMTP id v10mr465627ics.519.1302489311132; Sun, 10 Apr 2011 19:35:11 -0700 (PDT) Received: from [192.168.1.100] ([98.156.62.98]) by mx.google.com with ESMTPS id mv26sm3875986ibb.62.2011.04.10.19.35.07 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Apr 2011 19:35:08 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii In-Reply-To: <4DA26602.6080303@lorenso.com> Date: Sun, 10 Apr 2011 21:35:04 -0500 Cc: Internals Mailing List Content-Transfer-Encoding: quoted-printable Message-ID: <34592245-F3F3-44B6-9139-4F217CA9C962@gmail.com> References: <4DA26602.6080303@lorenso.com> To: dante@lorenso.com X-Mailer: Apple Mail (2.1084) Subject: Re: [PHP-DEV] proposed access modifier "silent" ... was: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator From: shadda@gmail.com (Matt Wilson) @. On Apr 10, 2011, at 9:22 PM, D. Dante Lorenso wrote: > The problem with implementing "ifsetor", "filled", or "??" in userland = is that the "not set" or "undefined" warning is fired before the = variable is passed to the underlying function/method. >=20 > Is it possible to add a modifier that turns off warnings for undefined = variables whenever that specific method is called? Something like: >=20 > class Utility { > public silent function filled() { > $args =3D func_get_args(); > foreach ($args as $arg) { > if (!empty($arg)) { return $arg; } > } > return false; > } > } >=20 > $x =3D Utility::filled($my_undef, $x['undef'], $nosuch, 'default'); >=20 > The modifier "silent" will turn all undefined or "not isset()" = variables into NULL values when being passed to the method and no = warnings will be issued. >=20 > Then, we can build our own damn functions as we see fit without the = fuss. >=20 > -- Dante >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20