Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105105 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91662 invoked from network); 5 Apr 2019 13:34:58 -0000 Received: from unknown (HELO mail-oi1-f177.google.com) (209.85.167.177) by pb1.pair.com with SMTP; 5 Apr 2019 13:34:58 -0000 Received: by mail-oi1-f177.google.com with SMTP id v84so4447275oif.4 for ; Fri, 05 Apr 2019 03:30:50 -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=DPRPCjjJ70Pvj+RpENz7jOJymhIn4umnyYywrPwVd9Q=; b=OaB0iiVialn6syZV2YapsImpMMLR+OYxSFGVtfYhaWnWUaXYSGYmHBMmP5xcZtxKgG ZsFGKOqkiMK5z2VTqikCzFK8T3lYbmmbchUebWJt5AllSHKbcNVBrgaLWEZjbJ0jO4aK XPTCQ+E9C8uITs2SEOgO5gyPrDVqABcgQ5emtD7+lq5RkRQDOC1fDahuRbcKwZwO/GIG 2l7i5Mr7xBN3M/DhHJknNDpYKu+V18pXy3CiQ96ZrZfDuQLxZFYyHXucSbHe6zVYHLkm G+rcs0dh0b53rtAvIeqzNiWv3Ae4HPw4YohYG8JVKPZjNvVF/8sLnkMjzqXcnxZ9pCwh BdQg== 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=DPRPCjjJ70Pvj+RpENz7jOJymhIn4umnyYywrPwVd9Q=; b=KoyP+zemPJ3NAC+LJNdHOQuQJT4/Lz2HsuSyyeMULW286HdPw7LoS4su8tvbEPozlk T7s8ipenzm0nEAys6Q48S+PLgQiW8FNgu14C7jfkYbRWwP8KZWrfCWtVNd6KIgAnqlxQ OmK13gx1X6JpyCE+D8kIkFWL8/sjlK2SzdriVkF1wgOqDt2A0zkcBgsDb2Ayth+hIPgq fALqVhZFMViHyiyKVtQVvpK9Att5qWVLdQV0K5JstBdFEpf+uwD41Hes1+iTyj+JBzWJ 8N+BdV40woWFDdwF9suLkifDCqr5nFAKaarTS7OermaCwmKZZxGeKaCTnN1VeztFGDcb xL4A== X-Gm-Message-State: APjAAAWkVdILuHNkRvwITLBZX9fijjr8KIybRME99ZV807joZYSq4yBt ePcKoAQ4uura7VRelStD8bqBmTZa6vckBy4KD/o= X-Google-Smtp-Source: APXvYqzySoAEhYd9lKAHZ3TZpQXkHqHn66+pSwTcU71JeaL0RNdGCFGRYJffUQV57q3XPnKigg2+edVn9S4ablAgtfU= X-Received: by 2002:aca:7215:: with SMTP id p21mr6589202oic.81.1554460250390; Fri, 05 Apr 2019 03:30:50 -0700 (PDT) MIME-Version: 1.0 References: <65AF9E1E-DFA6-47AE-952B-9ABEBD9B6038@gmail.com> <284d1f9f-03d3-1488-77dd-82e18edf9f4c@gmail.com> <3144F5D1-1F18-4C42-9B3E-AF1B1E598E47@koalephant.com> <917cb7bc-4abc-4bae-1a5a-b2ba1777fa55@gmail.com> In-Reply-To: Date: Fri, 5 Apr 2019 11:30:37 +0100 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Question about adding !function_identifier From: robehickman@gmail.com (Robert Hickman) > > The tricky part is that PHP is a highly dynamic language, so there's a lot > of cases where the analysis can only return "maybe". My understanding is > that this is what a lot of the work on Hack is doing: creating a language > which looks a lot like PHP, but doesn't have as many ambiguous cases which > can't be analysed statically. > Quite a lot of code that apparently cannot be statically analysed could be if the static analyser was programmable. To give a simple example: $result = mysqli_query ($conn, 'select * from some_table'); $arr = mysqli_fetch_assoc ($result); The contents of '$arr' cannot be known using only the data provided in this code, however it's contents is statically knowable. If a static analyser were programmable, it could parse the SQL query and query the database to find out what keys exist in some_table. Thus it could check for references to non-existing keys. I suspect this is the case for a lot of 'non analysable code', it can only function within a known set of states, but the type system is unaware of those states.