Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56761 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57264 invoked from network); 4 Dec 2011 14:26:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Dec 2011 14:26:10 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vw0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:61551] helo=mail-vw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7C/E7-13454-EF28BDE4 for ; Sun, 04 Dec 2011 09:26:07 -0500 Received: by vbbfd1 with SMTP id fd1so3489705vbb.29 for ; Sun, 04 Dec 2011 06:26:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=HsGMZhTuHLy4dW75apizlumTO9bFQu1F2QRiq+G5imM=; b=vbVLkvfcJpNtrldaE6I1XCfowQzs+2mYYbD8pLvVBltX8NvLI7AtlM1vcCFwBGtD8H ZeCR99F2bo9ZbybeJ/0XwUv/hULcFk/mqfMTckMFHufLlsNew87u/tAfga+ZGF+0b2/3 wP0arJOnS53UiyIHUAt46SOSqHG/qZFuZo+08= Received: by 10.52.33.50 with SMTP id o18mr2817416vdi.42.1323008762397; Sun, 04 Dec 2011 06:26:02 -0800 (PST) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.108.7 with HTTP; Sun, 4 Dec 2011 06:25:41 -0800 (PST) In-Reply-To: References: <4EDA4989.2010702@akbkhome.com> Date: Sun, 4 Dec 2011 22:25:41 +0800 X-Google-Sender-Auth: 1DHh-Q1Br1mXgXTD6SlCBrduV0w Message-ID: To: Ferenc Kovacs Cc: Alan Knowles , PHP Internals List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Fixing string offsets of strings. From: laruence@php.net (Laruence) +1. thanks. On Sun, Dec 4, 2011 at 10:05 PM, Ferenc Kovacs wrote: > On Sat, Dec 3, 2011 at 5:08 PM, Alan Knowles wrote: > >> I've had a look at making string offsets of strings a bit saner. >> >> At present with the fix for array dereferencing : =C2=A0?search=3Dhello = and a >> test like isset($_GET['search']['name']) =C2=A0results in true, which is= has >> potential security problems and is very confusing for any programmer >> finding and working out why something like that may be failing. >> >> To solve this quite a few people agreed that not allowing non-numeric >> string offsets on strings would be the smart way to go, the change is go= ing >> to break BC, so the idea is to at least not break it too badly... >> >> This patch is a start. >> https://bugs.php.net/patch-**display.php?bug_id=3D60362&** >> patch=3Dfirst_effort_to_fix_**this&revision=3Dlatest >> >> It's been quite a while since I hacked on the engine, so the patch only >> works reasonably well.. (see the FIXME on the tests at the bottom of the >> patch.) >> >> The patch changes the following: >> =C2=A0* $s =3D "string"; =C2=A0$s['offset'] -- produces a warning (and r= eturns an >> empty string) >> =C2=A0* $s =3D "string"; =C2=A0$s['1'] -- works as before.. >> =C2=A0* $s =3D "string"; =C2=A0$s[true] $s[false] $s[0.1] -- give a noti= ce (cast it to >> an int if you want to get rid of the notice) - however work as before. >> =C2=A0* changes the warning on invalid indexes to say "Uninitialized or >> invalid" rather than just "Uninitialized" >> =C2=A0* fixes most of the related tests >> > > I think that those changes are pretty much in line with the discussion th= at > we had. > Thanks for fixing this! > > > -- > Ferenc Kov=C3=A1cs > @Tyr43l - http://tyrael.hu --=20 Laruence =C2=A0Xinchen Hui http://www.laruence.com/