Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68114 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75490 invoked from network); 14 Jul 2013 10:21:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2013 10:21:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=hw2.eternity@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=hw2.eternity@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.48 as permitted sender) X-PHP-List-Original-Sender: hw2.eternity@gmail.com X-Host-Fingerprint: 209.85.219.48 mail-oa0-f48.google.com Received: from [209.85.219.48] ([209.85.219.48:36446] helo=mail-oa0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 98/91-52897-E9B72E15 for ; Sun, 14 Jul 2013 06:21:18 -0400 Received: by mail-oa0-f48.google.com with SMTP id f4so14516563oah.21 for ; Sun, 14 Jul 2013 03:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=pfcxr1PoYe3FRPMLjFAN/6bSCsnctWF1HJrTveybVHQ=; b=xur2tJKAhS1teHZBOSWjtu0omNCgFFjy6qDUhGXra7B/ADLjgZ13sIu5KBuLI/Jpj/ SC5pYNWpPYg6PN0odkoIu3o9dZH9LbfE8/LJ8ixkf7xQu5hNR2HBBg00m6p2CnS05Boy 2306DwYc7frXVMfRowpyUzxjEnQt7Y2UExxmFpye1HpAzLPJAHlZZbQIthzH8zOgtwNL 71HrfHbTY+ueCOvtsxBQJA5a7EuUVeb0ccpRyPf2bIAykLhxEjPCWPbxbQzEzPRgCFd6 RPcgzFZD1RM66iquczTt2Y+tidkRUS/uDs0UWakXd3kkdmpxXoJZVWDKLR8m6TS+j4Sl D/+A== MIME-Version: 1.0 X-Received: by 10.182.128.42 with SMTP id nl10mr39799283obb.41.1373797275711; Sun, 14 Jul 2013 03:21:15 -0700 (PDT) Sender: hw2.eternity@gmail.com Received: by 10.182.135.76 with HTTP; Sun, 14 Jul 2013 03:21:15 -0700 (PDT) In-Reply-To: References: Date: Sun, 14 Jul 2013 12:21:15 +0200 X-Google-Sender-Auth: BgmQUKluJ_X6lUrD875ktX1JvRk Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=e89a8ff1cc9e9cc0e404e1761ae3 Subject: Re: PHP proposal on modular systems From: giuseppe.ronca2@gmail.com (Giuseppe Ronca) --e89a8ff1cc9e9cc0e404e1761ae3 Content-Type: text/plain; charset=ISO-8859-1 sorry about code formatting mistakes..* **namespace {newversion* must be *namespace newversion {* of course 2013/7/14 Giuseppe Ronca > 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? > --e89a8ff1cc9e9cc0e404e1761ae3--