Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105428 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 19494 invoked from network); 25 Apr 2019 03:18:57 -0000 Received: from unknown (HELO michael01.phpgangsta.de) (31.214.144.173) by pb1.pair.com with SMTP; 25 Apr 2019 03:18:57 -0000 Received: from [192.168.2.24] (dslb-088-076-249-207.088.076.pools.vodafone-ip.de [88.76.249.207]) by michael01.phpgangsta.de (Postfix) with ESMTPSA id E78B46C0084 for ; Thu, 25 Apr 2019 02:19:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=phpgangsta.de; s=mail201210; t=1556151581; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pDCu62xy4Q3SuVYamoWMrn9KpiwOtoL/bl0jYnnp6d0=; b=Kif1zT1AaUnYQoFG/iEdV9XqFgaIPvqP/EsjojLBgGI1C2mtrmLa1cLUNQKC+ppSCcYRxt 1lFdHQbi3Xt8TckuDKnbp2fFfIQLlTQ47R8RjFC16Gd/aCjaU6Zj+q642V4oF1Dm58YCOG n3t+pBLF7Hkfd7IXkF3CrCZsiA3a5so= To: internals@lists.php.net References: <59cafbfb-2bb0-468c-458f-74bcac780e0f@korulczyk.pl> <004c01d4f09f$880ac320$98204960$@roze.lv> <004401d4faa3$60f83700$22e8a500$@gmail.com> <2f922f17-bc7c-313a-8f77-122e861995be@lsces.co.uk> <5741936F-B1F4-43C7-B815-F9D8030AC7BB@koalephant.com> <49A4B76C-4C62-4CBE-BA20-FBE56CA29AB0@cschneid.com> <609E93CF-099B-446C-AD28-04F1D802C9F0@cschneid.com> Message-ID: <85e05f77-e828-9634-adec-f7d798d9f0b8@phpgangsta.de> Date: Thu, 25 Apr 2019 02:19:38 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=phpgangsta.de; s=mail201210; t=1556151582; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pDCu62xy4Q3SuVYamoWMrn9KpiwOtoL/bl0jYnnp6d0=; b=BgRhFCqSfIi7+0kXSJej4k4359A9pAw1EpIK5eyIT+AU5OvFK/3CNTzrNWI6qy1xW7lqcd 3qCRjI/z2KyAe5dbvj4HKejiB6WWMeqpjD5smVNV1LMUBFDCFbFNuYDoECoPo2Vl/ndEmu QIDKEWPR9Te7vMlCdfv9y+K+c5Odi54= ARC-Seal: i=1; s=mail201210; d=phpgangsta.de; t=1556151582; a=rsa-sha256; cv=none; b=SMg3GuzJawjBSdus/Sa4OQiaj7FCBRS5mBbxFBA33SLWLZVxsV3/Ec+YzCNEQuVVKALrUK xNd06jIbWUAsgulVbvVXFfqUaRsX0QGYCDTLLQdARBfOaXDzVDf8Ps13l0/Vbd9TC/ijNW 54IixXiBpOfp76mufSCGmUU13zp3rCI= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=info@phpgangsta.de smtp.mailfrom=info@phpgangsta.de Authentication-Results: ORIGINATING; auth=pass smtp.mailfrom=info@phpgangsta.de Subject: Re: [PHP-DEV] [RFC] [VOTE] Deprecate PHP's short open tags From: info@phpgangsta.de (Michael Kliewe) Hi there, Am 24.04.2019 um 21:07 schrieb Peter Kokot: > Hello, > > On Wed, 24 Apr 2019 at 19:44, Chase Peeler wrote: >> On Wed, Apr 24, 2019 at 1:27 PM Marco Pivetta wrote: >> >>> Run a fixer: they are out there, and they are extremely stable too. >>> >>> Also a good chance to finally take a look at code that has been rotting in >>> a hard drive for too much time. >>> >> All of that takes time though. I have 6,787 short opening tags found. Even >> if I use a fixer to generate a diff, or, to fix them and then examine the >> diff in a pull request... that's going to take a LOT of time. It's going to >> start getting messy if I find false positives and need to exclude changes. >> It still doesn't address the impact of changes that aren't found. Are you >> 100% positive that the fixers out there will catch EVERY single instance? >> php-cs-fixer doesn't update > dynamic code, then that's not getting caught. >> >> The output from php-cs-fixer just generated a diff file that was 161,000 >> lines long. But yea, that's something I can scan through real quick and >> make sure nothing is going to get broken. No chance I'll miss something >> either. >> >> I would LOVE to have the time to go through our legacy code and clean out >> old stuff. We have a lot of technical debt that, while we aren't paying it >> off at the moment, it's gaining any interest either. We also have plenty >> that is. It's tough to justify putting off the stuff that is gaining >> interest to focus on stuff that isn't so we can fix short tags. >> >> I don't work for a software company. I develop an internal application for >> a non-software company. There are 2 other developers and enough work for 10 >> developers. It's going to be VERY hard for me to get management to approve >> putting off projects that have a direct impact on our business in order to >> upgrade to PHP 8 when that time comes. I think you are going to find that's >> a pretty common occurrence, and the adoption rate of PHP 8 is going to be >> VERY low. Especially when more and more user-friendly alternatives like >> python and node are coming along. It was one thing when the options were >> RoR, ASP.NET, and JSP. That's not the ecosystem anymore, and it's only >> going to provide additional user friendly opportunities in the next couple >> of years leading up to PHP8. >> >> Can someone PLEASE tell me the positive gains this RFC will accomplish that >> justifies risking: >> 1.) Losing market share >> 2.) losing credibility >> 3.) removing a large number of libraries that are fine from a technical >> aspect, but will stop working due to the existence of > 4.) new security risks (code leaks that are more likely than the code leaks >> the RFC seeks to prevent) >> >> And, please don't use the existence of code fixers to justify this unless >> you are willing to demonstrate how it's quick and easy to go through a >> 161,000 line diff file or are willing to 100% guarantee that the fixer will >> not break anything, will not fix anything it shouldn't, and will not miss >> anything it should fix. >> >> >> >> >> >> -- >> Chase Peeler >> chasepeeler@gmail.com > I've done few commits with about 8k files changed with very repeating > changes like this and without breaking anything. It will take you > about 30minutes... Let's say, one hour for also taking a break from > all the scrolling the git diff and to return the merge the next day > after another check or something like this. > > The change (speaking for 8k files using short opening tags converted > to the memory_limit needs to be increased a bit and only relevant change > is done in all files. 8k (or 6k) opening tags is nothing very big > actually. > > Then also search for similar occurrences by using a regex for those > edge cases you're mentioning in strings and such (I doubt there are > but ok) and you have this fixed. Then run this app on PHP 8 and you'll > see the other BC breaks that happen due to the major release. Major > releases are meant to break things because otherwise we can only load > the language with new things and maintain old stuff in there for > eternity. > > That's why serious apps have support cycles and follow their > frameworks release and life cycle, and in the end also PHP cycle. > Simple as that. > > -- > Peter Kokot Some thoughts and numbers from my side. Nobody should not use a simple grep or sed like this: grep -rin "">
./scripts/XXXupload.php:68:        Text2:
Binary file ./library/phpillow/tests/phpillow/data/image_gif.gif matches Binary file ./library/phpillow/tests/phpillow/data/.svn/text-base/image_gif.gif.svn-base matches ./library/ezcomponents/Mail/src/tools.php:225:        $pattern = '/?$/'; ./library/XXXX/SoapApi.php:1: result.txt Reviewing these 51 changes took 3 minutes. No false positives here, all of them were at the beginning of files. BUT: it didn't search in .phtml files. php-cs-fixer by default only processes .php and .phpt files (depending on the version you are using, older versions also process .twig files as far as I can see). If you use it, you may have to add other file extensions like .phtml, .tpl or similar, depending on your project. Running php-cs-fixer on .phtml files in that project results in a diff file with 9527 lines, 1573 line changes just in the .phtml files of that project. Whao... I'm not sure if I'm alone, but I have lots of template code like this:
Xdata as $index => $data) { ?>        
Something
Blindly replacing " Xdata as $index => $data) { ?>        
Something
The nice visual indenting of the "foreach" with 4 spaces is broken now, and cannot be fixed, because "