Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68115 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77185 invoked from network); 14 Jul 2013 10:30:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2013 10:30:23 -0000 Received: from [127.0.0.1] ([127.0.0.1:3479]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 10/F1-52897-EBD72E15 for ; Sun, 14 Jul 2013 06:30:22 -0400 Authentication-Results: pb1.pair.com header.from=hw2.eternity@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=hw2.eternity@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.181 as permitted sender) X-PHP-List-Original-Sender: hw2.eternity@gmail.com X-Host-Fingerprint: 209.85.214.181 mail-ob0-f181.google.com Received: from [209.85.214.181] ([209.85.214.181:61601] helo=mail-ob0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/91-52897-FD972E15 for ; Sun, 14 Jul 2013 06:13:51 -0400 Received: by mail-ob0-f181.google.com with SMTP id 16so12773633obc.40 for ; Sun, 14 Jul 2013 03:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=62q8rvTdWdnBgd9L91DgXTCz4Gz/cB0Dzu+NZ4JGYUU=; b=aOrl6Vgl7Tx/DMboKTC+AF2PaT37a0TKGg957cnHzEZ6II3wr3b/hVpkRkS2ukhh3I 7bOavfONYLQItI2yr94kP7VrKWGyfa1mwMCSgLRSp/WsET3JfVgSjYLWYLrtMLKPeOFO 783rAOdnX03LtXo9cB0t6mcbdVfwAKGvUxkhYBJ3ct+bZUIrIu9ZnR+6gBZZ+dVnFOfA eUAjE/F8mkSmgAY+eDuKvx376AO5V3WdXIrwdgAkG2QmS35lKTFZDxgD1cmA4IwAar8d goAKfCpEsTKIh4pHLWL1Vnf5rIv+NXIqTJCfqUwVzf1G5tMmyH3+ke3wpBp+J8i5HqSV azaA== MIME-Version: 1.0 X-Received: by 10.60.98.41 with SMTP id ef9mr40170160oeb.68.1373796828680; Sun, 14 Jul 2013 03:13:48 -0700 (PDT) Sender: hw2.eternity@gmail.com Received: by 10.182.135.76 with HTTP; Sun, 14 Jul 2013 03:13:48 -0700 (PDT) Date: Sun, 14 Jul 2013 12:13:48 +0200 X-Google-Sender-Auth: sEhsB-sjWzScTEH48-K6VE0t98w Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=089e013a100af798a204e175ffde Subject: PHP proposal on modular systems From: giuseppe.ronca2@gmail.com (Giuseppe Ronca) --089e013a100af798a204e175ffde Content-Type: text/plain; charset=ISO-8859-1 Php is now used by many CMS, many of which use a modular system with a wide range of add-ons developed by third parties. This can cause various conflicts, such as when two or more external components using the same library (i.g. with a different version) in this case the classes / namespace will be in collision. This can become unmanageable by the webmaster because they are not always able to change third parties code and there aren't other "clean" methods to solve this kind of problem ( complex and dirty eval methods excluded ). here you are a thread related to this issue: http://stackoverflow.com/questions/17628475/php-include-different-version-of-same-library *One possible solution* would be to extend the scoping for the inclusions of files using something like:* local_include_** in this way you can also create a sort of "nesting" system for classes making possible a syntax like this: class foo { public static function bar () { local_include "test.php" / / file which includes "test" class; return new test (); } } echo get_class (foo :: bar ()) / / output: "test" new test () / / raise an error instead *Also this could work:* namespace {oldversion local_include / lib/api-1.0/library.php; } namespace {newversion local_include / lib/api-2.0/library.php; } $ oldlibary = new oldversion \ Library (); $ newlibrary = new newversion \ Library (); It shouldn't have backward compatibility issues since it's a new implementation and you shouldn't change anything else. What do you think about that? --089e013a100af798a204e175ffde--