Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101314 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34077 invoked from network); 11 Dec 2017 08:24:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2017 08:24:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=andreas@dqxtech.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=andreas@dqxtech.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain dqxtech.net from 209.85.215.50 cause and error) X-PHP-List-Original-Sender: andreas@dqxtech.net X-Host-Fingerprint: 209.85.215.50 mail-lf0-f50.google.com Received: from [209.85.215.50] ([209.85.215.50:44057] helo=mail-lf0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/B9-53433-3A04E2A5 for ; Mon, 11 Dec 2017 03:24:04 -0500 Received: by mail-lf0-f50.google.com with SMTP id x204so18128608lfa.11 for ; Mon, 11 Dec 2017 00:24:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dqxtech-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vi28Y5FOogbq9mqS/tubJ6XsO16T2hoQjQkgFSv13Vs=; b=UiT4HolU2emQMndYt3249feIzQuC2Z5zTAJLVZxkbKoKkd0zymlqFMYP3veGqjVbN3 Say+2lI3WtTYMnEkbpkUaqKSMgnU7oFd9ZeLR/O/ZHjJLpr9Kk9J500rKUmzhz0qAmG1 PlHkq/LiU3S96/V5DqFsdKiqA3O1tHRxJ4l5XthAoOB6Ff8bdk8XZOcRZGrG1L4D8iHh rY4UMsOrFgKKc8BTMOizZ3t2NQGaSAoOBNZ3MulzrJVJGyUWSv5+2z7nk1TfVYq6o/Iu 6E7KKlwiJQ9Xeab44E/oz4QgV7P7feb7EdZvNX7myvYZjCUdHQ95O9/Mek9WGDXzIMnT tRTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vi28Y5FOogbq9mqS/tubJ6XsO16T2hoQjQkgFSv13Vs=; b=NAXP6k3VWsuecBnmDzv+WovAjCdnCqRnVeIIVecmbsT5nx5ZqNPdOvTsVXF7jQycbC iH7gWap1KmvSca54jDqophVeiTG6XPHWmgMtk8YIcMV7DzJYryv4y5o1XW+k/vRzI9dq XSVDQ9+8YBdpIozCfUr45XY8xyzqb6Dlp1FDQlo88qMZNYejy/RYx8vZYFRN5c9kY+cd icoROv1sxz0thfBR4nQ9duaIsHMQzpkbvQ8meGRrTwX7LSyJTdNGV1Q4np8kOlrp2BYN RetV7BWOuuhOZL3T5QCM+kYE8qF/naEvwGDCSzVuXTf/jr2449s2rklGd9dRD+ADyeQ/ /pFA== X-Gm-Message-State: AJaThX6x+h6syPog2SImW6rHhyTgNSzU9Vf7lq5lFsFOrcERDKGbfQME fdlADnqwBsZ5aOx1pETBQz42DI+L X-Google-Smtp-Source: AGs4zMYVtuMt7Ozn0WFlTM0B4is5uTVJeNgxeJVmn/mXvtnv3UNyDQwnz16ynQmCMCSiGC0tQkzYXQ== X-Received: by 10.25.168.140 with SMTP id r134mr16490883lfe.65.1512980640078; Mon, 11 Dec 2017 00:24:00 -0800 (PST) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com. [209.85.215.52]) by smtp.googlemail.com with ESMTPSA id t25sm2703141lja.92.2017.12.11.00.23.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 00:23:59 -0800 (PST) Received: by mail-lf0-f52.google.com with SMTP id f13so18138916lff.12 for ; Mon, 11 Dec 2017 00:23:59 -0800 (PST) X-Received: by 10.46.91.79 with SMTP id p76mr20874822ljb.22.1512980638747; Mon, 11 Dec 2017 00:23:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.25.170.16 with HTTP; Mon, 11 Dec 2017 00:23:38 -0800 (PST) In-Reply-To: References: Date: Mon, 11 Dec 2017 09:23:38 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Marco Pivetta Cc: Niklas Keller , PHP Internals List Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] ReflectionContext for imports and namespace From: andreas@dqxtech.net (Andreas Hennings) >> These side effects would be that the class loader loads files which can >> break things? > > > Yes. Reflecting over a codebase which contains even just polyfills > (duplicate classes) can already lead to unexpected crashes. Reflecting over > non-PSR-2 code can even lead to worse things such as starting a DB > connection and performing unwanted operations. > My own use case avoids this problem. Instead of randomly scanning anything, you need to tell the annotation parser explicitly which namespace directory you want to scan. It is the caller's responsibility that all class files in this directory are nicely shaped, and can be safely autoloaded. In fact I did use a userland parser in the past, but then decided that native reflection is safe with the above assumption.