Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120325 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5308 invoked from network); 17 May 2023 15:13:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 May 2023 15:13:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 63F3C1804C6 for ; Wed, 17 May 2023 08:13:46 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE, MISSING_HEADERS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 17 May 2023 08:13:45 -0700 (PDT) Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-966287b0f72so157345966b.0 for ; Wed, 17 May 2023 08:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wikimedia.org; s=google; t=1684336425; x=1686928425; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=86h0xorsFdoYuNn2FiiO/Vo5AIadtgI4rWetGFymGZA=; b=HDksDDtTBxTB8/NDYheLUDVDJA0UQ3FTOhIPqc5LlcN9msIX/TJvsnRdJsQn4gPcPp tuy2qIndAWLlzvw82nBWHJZdK7lrPDH5laI77bLgLXsa88CG7T4xpwfnzBYMT4k7BxKe r5vupA52gxa8Y/xFwvNCVYfhb+ZVXglqoZ7cw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684336425; x=1686928425; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=86h0xorsFdoYuNn2FiiO/Vo5AIadtgI4rWetGFymGZA=; b=bbHy2QMf3JBaHPKucs50VDMuhEqbfTyHgFWyF+0Szs8MhlPPu9fsS86dMDlOsq2b8u e1c7vJc9XYYk1HYPT7xvOUdN6aXul6q30zFxMkYM9BK48e9II5m+P0tOG4cy+w95exZm Avwv8ppttL3bX/3DpAdUu2mMtrOJcUmI0mezK82noLFmM8Al+A4ISBKBfEuOjVYNNo2E lXHd102v5lKElQ2DLAbIhZ/XgJ3et03hR+zwpZsVULB9dsa5dPocJFJn9SwH0HXsXbYm j7skQiYMpdmodB+CAlgK41xJLeNbu7yyI9YpOUdiPSdkAgIu41UnqJfso5MSoj4VEeRx pcMA== X-Gm-Message-State: AC+VfDyY/h4XMcpSzwN3X2xr3b8sl894vClPoRyQYpNqwFKaw7/KWyZH ycsSYvWXmklhppTG86RbS85vxaEIzjypxU0RwB0ETznmbK7OQQrfHEI= X-Google-Smtp-Source: ACHHUZ45JfDrXiFeSfcnPsv2l3KJS3lBvW7UWqDZjHffjoR+XlruOI1xnXv09nWn6NA6wOWe5ayuagUZ/v/WeZyaE5M= X-Received: by 2002:a17:907:2687:b0:961:a67:29c with SMTP id bn7-20020a170907268700b009610a67029cmr36281403ejc.70.1684336424538; Wed, 17 May 2023 08:13:44 -0700 (PDT) MIME-Version: 1.0 References: <4ECF6970-2A01-4C47-9B41-87D534F54CB8@shyim.de> In-Reply-To: <4ECF6970-2A01-4C47-9B41-87D534F54CB8@shyim.de> Date: Wed, 17 May 2023 16:13:08 +0100 Message-ID: Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000044b6f505fbe5225c" Subject: Re: [PHP-DEV] [RFC] path_join function From: ttijhof@wikimedia.org (Timo Tijhof) --00000000000044b6f505fbe5225c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable In case it is of interest, the implementation we use on Wikipedia as part of MediaWiki, is available on Packagist: https://packagist.org/packages/wikimedia/relpath https://www.mediawiki.org/wiki/RelPath -- Timo Tijhof, Wikimedia Foundation. https://timotijhof.net/ On Wed, May 17, 2023 at 3:54=E2=80=AFPM wrote: > Hey, > > I have created on GitHub a feature request for a path_join function ( > https://github.com/php/php-src/issues/11258) and got the label that this > requires a RFC. So I am here now :) > > The idea is to provide in PHP itself a function to join filesystem paths > (idea: path_join) like in other languages, node as example ( > https://nodejs.org/api/path.html#pathjoinpaths). For me this function is > some kind of base filesystem functionality like basename, realpath. > > Example usage: > > path_join('/base', 'my', 'path'); // /base/my/path > path_join('/base', 'my', 'path', 'test', '..'); // /base/my/path > > Why not just string concatenation? > > When you concat just the paths you have to think about: > - normalize string part to strip ending slash > - for windows compatibility you have to use DIRECTORY_SEPERATOR > > I think this can improve the developer experience when working with > filesystems a lot and people can delete their implementation. > > I am really looking for your feedback, right now I have no =E2=80=9Ckarma= points=E2=80=9D > to create a RFC in the wiki :) > > Thanks, > Soner --00000000000044b6f505fbe5225c--