Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102843 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78706 invoked from network); 16 Jul 2018 11:21:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2018 11:21:24 -0000 Authentication-Results: pb1.pair.com header.from=arvids.godjuks@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=arvids.godjuks@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.41 as permitted sender) X-PHP-List-Original-Sender: arvids.godjuks@gmail.com X-Host-Fingerprint: 209.85.218.41 mail-oi0-f41.google.com Received: from [209.85.218.41] ([209.85.218.41:33441] helo=mail-oi0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/09-39793-3BF7C4B5 for ; Mon, 16 Jul 2018 07:21:23 -0400 Received: by mail-oi0-f41.google.com with SMTP id l10-v6so27342046oii.0 for ; Mon, 16 Jul 2018 04:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7fSKFwo1h9RyvNPamBmKuiMZSEt9/VgGNv53D+AcubU=; b=DaHARYkiTdemHydKgPfHE61sZNuEhOo6zw0G01bWELflqrCgJOVCfxX17wxW9wO81T RSrfqiuNaImv4UwzP193EFJITMR1LqcJutd6PWMemqp8m7hiMz/hiiLHbFk+R4poFITY GJW5KhFH/hZFUslTo0Eipr2UcVCNtYz+JFz45Nc60vTMNRbpbgDsLRYQqg5Pa5bhMa8G w2U42RYJFfbNphj9CiVF62MSQAbEAsVVTfUJrMk0pCJoQAO5HYZ4PTGch3dpEIaxj/0V lq7bEwwdlUpNifvmGfiGTDpyHOFvK9AiHyZD+/xcPJKbKgxacVviltcXe7xGyN5dAVeQ vrHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7fSKFwo1h9RyvNPamBmKuiMZSEt9/VgGNv53D+AcubU=; b=ayls5TF7Go6o1XfAWY12ImaU7l0czlTSJna2MXndy7I0zAJQuHuubQeyeelZaro7t4 MuN3C4cbZbVaprgpijq/lDQBFozvlUP7IKaiU8+3yEuLx+uDobgi3I3sQf8PbOJvDj3T J5UOngJ4jqMKcSQqJ6gWUPn4boQEcHPBT475qTQ3dMa0xvqIJMmdpgjks/DaPlftzVLs Eq93hwOPoTzHjQiVoq06Q7Ml7ISkwD82LqFEJyiC6wBld0I6kDEMYLUM61hw2QccPsZP EReMez5pjoZdK/Jqh5PnjcECzk7dKUWQ6M0edk8Vm0m4ukvQyzG0tevD1jLDRYpDraea ET2w== X-Gm-Message-State: AOUpUlGQK0i9xFUNm3DIhpn1sDz3NwMbSNpU2DC73N9WGLYSIx3oyKwv CmihsDGM43aFcDv/HgZTu7a1NqYhDEs1qfrJf60= X-Google-Smtp-Source: AAOMgpfbgUwutQBukXFMNJs6QsAoIxMGKdTkiLsr7BsqPnJwBu03uHAOWDJswJ5eLw9tCKF7rCG6H1XsGHcIb2VJbo8= X-Received: by 2002:aca:56d7:: with SMTP id k206-v6mr16290960oib.106.1531740080980; Mon, 16 Jul 2018 04:21:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 16 Jul 2018 14:20:54 +0300 Message-ID: To: mitke013@gmail.com Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000006a46ce05711c074d" Subject: Re: [PHP-DEV] [RFC] Optional typehint check for parameters From: arvids.godjuks@gmail.com (Arvids Godjuks) --0000000000006a46ce05711c074d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =D0=BF=D0=BD, 16 =D0=B8=D1=8E=D0=BB. 2018 =D0=B3. =D0=B2 14:14, Zeljko Miti= c : > > > On Mon, Jul 16, 2018 at 1:06 PM Arvids Godjuks > wrote: > >> =D0=BF=D0=BD, 16 =D0=B8=D1=8E=D0=BB. 2018 =D0=B3. =D0=B2 13:56, Zeljko M= itic : >> >>> I tried to, but I honestly can't see the problem. No decent programmer >>> makes error by sending wrong type of parameter and this feature is 100% >>> optional. I know for sure that even in my dev computer, I would use thi= s >>> feature, and probably most programmers aware of the issue. >>> >>> Maybe simpler example: if I send a string to above function, the only >>> difference is that PHP would start executing inner code. But an inner l= ine >>> like $user->getEmail() would still throw fatal error, still very easy t= o >>> spot. >>> >>> But again, I really don't see that happening and I am not an expert. An= d >>> I still never make errors like that, not even when I was learning php. = And >>> if dev computer keeps checking type (default), it is very easy to spot = a >>> big mistake like that. >>> >>> Given this is open discussion, I would like to see where I was wrong. >>> >>> Btw, you were not harsh at all. >>> >> >> Basically, you went wrong when you proposed a switch that controlls >> language behavior. To add to that - a switch that probably is not >> controllable by code that is running. >> >> Long story short in a time of php 5.3 - 5.6 it was collectively agreed >> that switches that control language execution are evil, are hard to >> maintain and having language behave differently due to hosting enforcing >> one or the other setting and you as a user having no way to control that= is >> just bad. Since then, the most evil switches were purged with extreme >> pregidece and trying to introduce anything even remotly close to that is= a >> suicide mission :) >> >> P.S. RIP magic_quotes, register_globals, short_tags and some other >> articats of old. May you never be disturbed again. >> >> >> -- >> Arv=C4=ABds Godjuks >> >> +371 26 851 664 >> arvids.godjuks@gmail.com >> Skype: psihius >> Telegram: @psihius https://t.me/psihius >> > > Ok, I see your point now. Bit isn't opcache.validate exactly the opposite > of that? When user deploys the code, he would not see changes before fpm = is > restarted. Or worse; if opcache didn't cache some file because it was not > called before, more problems would happen. > > But please, do keep in mind that I would like to have this feature as > optional. > Opcache is not the PHP language - it's an opcode caching tool that is bundled with PHP engine for performance reasons. It does not change language construct behavior. It does not impact the application behavior - it only affects code loading performance. Think of it as a memcache/redis for your database - same idea. --=20 Arv=C4=ABds Godjuks +371 26 851 664 arvids.godjuks@gmail.com Skype: psihius Telegram: @psihius https://t.me/psihius --0000000000006a46ce05711c074d--