Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84004 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64585 invoked from network); 27 Feb 2015 13:58:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2015 13:58:39 -0000 Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 209.85.212.178 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 209.85.212.178 mail-wi0-f178.google.com Received: from [209.85.212.178] ([209.85.212.178:35081] helo=mail-wi0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/E0-32582-E0870F45 for ; Fri, 27 Feb 2015 08:58:39 -0500 Received: by wibbs8 with SMTP id bs8so397871wib.0 for ; Fri, 27 Feb 2015 05:58:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=2lYZ6Cpm/0XrC/IvcX14pmFdYsKeNfZlfx0ZVRgE23Y=; b=DohxZ1iSGucWxIFkavDOTkff0wWyMk2+4owV+EuOMDb4iOqGPmQlueZMqG821s5AQ9 FZ6cQzdHEu1HcmKN7tTEVKY+jA5hUT9rm58meZWKxLmSjYdr+PJB7TJl5ip6VNpOQ9Bd tBJq5ot79a8x08xs4+7oQeIOe9VaSj91+LNQCJOmqcEZ9jOZnVAESSezmvC5M6o0QXaX +6Mpk1KQByHL0UgwxM2GeEb1VryrsGiEtc7fiWLHDb504fHHQz6B3v+ryGn9KsYVFwZ2 11JHKYa+MAPn9U2DYpvu469kLv4XPryF1BwHde6zYqciz8qtyDLiwOuNaBf8zHMXLd7A b2dQ== X-Gm-Message-State: ALoCoQmNBqAraysvJujhsfQIPFAIXPtIJWQrI7KWqRDBfW218AjBlCigO6rvTGzhHnqpRkjWXxmm MIME-Version: 1.0 X-Received: by 10.180.149.242 with SMTP id ud18mr6704485wib.94.1425045516074; Fri, 27 Feb 2015 05:58:36 -0800 (PST) Received: by 10.194.192.202 with HTTP; Fri, 27 Feb 2015 05:58:35 -0800 (PST) X-Originating-IP: [87.139.115.236] In-Reply-To: References: Date: Fri, 27 Feb 2015 14:58:35 +0100 Message-ID: To: Damien Tournoud Cc: Zeev Suraski , PHP internals Content-Type: multipart/alternative; boundary=001a11c26958c6540205101243be Subject: Re: [PHP-DEV] Coercive STH - some real world tests and updated RFC From: kontakt@beberlei.de (Benjamin Eberlei) --001a11c26958c6540205101243be Content-Type: text/plain; charset=UTF-8 On Fri, Feb 27, 2015 at 2:37 PM, Damien Tournoud wrote: > Hi Zeev, > > On Fri, Feb 27, 2015 at 12:57 AM, Zeev Suraski wrote: > > > Drupal homepage: One new E_DEPRECATED warning, which seems to catch a > > real bug, or at least faulty looking code: > > $path = trim($path, '/'); // raises E_DEPRECATED, as $path is boolean > > false. > > return $path; > > > > Drupal admin interface (across the all pages): One new E_DEPRECATED > > warning, which again seems to catch a real bug - stripslsahes() operating > > on a boolean. > > > > All those are due to a bug in substr(), that we see now only thanks to > proper type identification. There is no reason for substr() to ever return > a boolean. It really needs to be fix to always return a string. > > Damien > This kind of code here exhibits the failure: https://github.com/pdepend/pdepend/blob/master/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php#L584 This is classic PHP style code where you rely on the implicit casting to make the algorithm work for you. if substr() here returns false, then the error is: 1767) PDepend\Source\Parser\UnstructuredCodeTest::testParserHandlesNonPhpCodeInFileProlog strlen() expects parameter 1 to be string, boolean given /home/benny/code/php/workspace/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPTokenizerInternal.php:586 The funny thing is that the fix for this is: - substr($image, strrpos($image, "\n") + 1) + (string)substr($image, strrpos($image, "\n") + 1) Which is that sort of casting that is put forward as argument against the dual/strict mode. --001a11c26958c6540205101243be--