Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124650 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id CF2A51A00B7 for ; Sat, 27 Jul 2024 13:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722086872; bh=jUTc+yjYrMMrIc4UDEx0giAPk941fBXUsUCqmhy7cmI=; h=Date:Subject:To:References:From:In-Reply-To:From; b=WV64whEX3dRW67mG/wen+csdBQCPBVK4rU9u4fLLqG6IbkdnKDkdf9plQxgL7ks44 WQDOQy0pCzFE9JB2duMUxNirKAoBqkxeYXrbemJ8BsbSN4gIQ2LPCJBiD9fuNfUhi4 +NF2LEWiy/sbx2g0pyFS6zHBzmsRIgdu4QuDSBTcZcx4VpklK87FX52tFR4/szMPi0 83+ipdn7BCDNoHYVVPIBaIPlYwRXXItlM9Rb4a4y2YFdkWTzee5/dmnZRQFTxExugv N+J+W9pmofeMHQD8IPOjCRBC7IJXzd0H2CmvgxQnD9DTVMRETyEV+kdijAbDI8Rh5l EM9bhyrja07gg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0432318003F for ; Sat, 27 Jul 2024 13:27:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 27 Jul 2024 13:27:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1722086769; x=1722691569; i=cmbecker69@gmx.de; bh=wIjZozWrN9KLmUpC9IKhhDsjbvPScZKY15Grqa2tNk0=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=Hvas2gb96Ha2cqUkTrH4JL0L6WyurZLJTniyMgX6W8XyZ1TPf+2NkYtADS9o0FvS 08kSWHnxDePr3CyBtK4NcLiC9oBscI8eHIBXdGwRRNODnpaOfRrYpUPsFHpnDQ/Kw KdhSkSa2LXYrdKCcxGFJkkQqVmtZD1vmACXOrVzHlFdeRyTRnIYHv7hvILaQAF2Gd ANSFMI+Zd3bwIqmmYVQJBmg26vAG5tdzspq8ssDlIxegeCaqUV8kXtgu9atNpliY+ tTMSC/XIXgRhj7BxG2KGX+1Xb1Q8Q2WLRyT9MGGAuiPe0go1w4iUK2ZEC/6SNd5ix dg3tCvNhlndMZrnO4g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.2.130] ([79.251.205.37]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MOzT4-1suiSr1HsC-00IR9A; Sat, 27 Jul 2024 15:26:09 +0200 Message-ID: <5155581a-3531-4af7-98d3-e637accac16e@gmx.de> Date: Sat, 27 Jul 2024 15:26:09 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Working With Substrings Content-Language: de-DE To: Rowan Tommins , internals@lists.php.net, Thomas Hruska References: <92c4514f-70e3-75c9-7084-9e29641e25e7@gmail.com> <7e86a2d2-b971-592c-64e3-e86c13b5be80@cubiclesoft.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:qv72CZi71wp1rbGf7aVVsAQL13/H45tSy6nFFrPN2yKFfx5KBsN G5xjQ7DPcQp5GrU3brsTuubhogiAslwJlk6stw1EVjKXMx60hEUWIB7B76aj7BbY5qVwfJr IDrXWO38CKTKRxjuQgZgClRqHK3KuwWHq2sSh8r42ciKsuDM67br80yfmzJ2w9E7FZJIzx0 i3Vm2d8Hf7hwgtUifPngA== UI-OutboundReport: notjunk:1;M01:P0:FNxplDqtGbE=;tQTR81Xu8ZaWnlImDBddSr2o/7R fCn8A6Sus+XvteyFOSVa2tf2B34/K+KxXOgwnOBvW2eZXK0V+OgpQLDp5tDmfCrF/59mj2Eb+ /X0Fk/v8kqXiTEhM+1A1XSXp87DXXEZgsOtY87mC4bEAvIEFurbcvEce1n68iagD9wCIPwdQR bUyVe/8meJCylH7FFbH/zbiEzYHe3LSfgACy7iKwBKesR77HHhqtDX6HJulSgCNxldUdONV7B 7BAH4AqagXNjx2WbR88AB7EJgQqA5gbQ8UY0APj93hmbnWpLA/Abwd0ucE007jZtUQM7XdYZM pklgeA6ZNIOmkxkN+xeBVVWk9F/fgF+FidIrApUJ3/0MxR/CyemqSRyK+JGow6wSUsDywzFyn rpEpKcnDyMCUWr7bGu7Ofk04DMfbsI9LjAlClE1/jILR4mDtYUS35WZCcnM5XqzDwXIjgNL/a oNJNnvGcelmZCA9EfKTCOILVESGDUsm/StosEGaCYCWEevOkeOMBspvAuK6RfeXGJvdXWbwYR 3Cz612ObpWPBodyxRNPGB30CxdRwFMGSosib5jBwxHJQaKWNlLb6dSUhzveZzO9fxel5+3hG1 vZILHbCVYoYXkWf+DoAiPCicuxvbOIf575HvsWqEVrw52/s2RyQ77VUu9bRg3rn/CkkGqrJMT DOuk4qtBa2ffRG7WxAjmzfrqG/RxUFrNTTYBtVsoSiqLf6/8E6EsVrRSQstFSqliL80ZGlz9r nGGJJJ4qtcX78Vbp9pJnEms2GCwNAsGu5EPS8Crcm3UJheMTukiM96CLDl8yNMaNBE80dNLmk cv1T6ce7PGI6IH2GsDWsS9IkD8y+k6q4AwN2BLlERJ9GI= From: cmbecker69@gmx.de ("Christoph M. Becker") On 15.02.2023 at 06:18, Rowan Tommins wrote: > On 15 February 2023 02:35:42 GMT, Thomas Hruska wrote: > >> On 2/14/2023 2:02 PM, Rowan Tommins wrote: >> >> I thought about that but didn't know how well it would be received nor,= perhaps more importantly, the direction it should take (i.e. a formal Zen= d type in the engine, extending the existing zend_string type, a class, so= me combination, or something else entirely). All of the more advanced opt= ions I came up with would have required some code changes to the PHP sourc= e itself with a new data type being the most involved and probably the mos= t controversial. > > My instinct was that it could just be a built-in class, with an internal= pointer to a zend_string that's completely invisible to userland. Somethi= ng like how the SimpleXML and DOM objects just point into a libxml parse r= esult. > > Then to add to existing functions requires changing an argument type fro= m string to string|Buffer, rather than adding new arguments. > > No change to the type system needed, internally or externally, just some= code to unwrap the pointer. But perhaps I'm being naive and oversimplifyi= ng, as I don't have a deep understanding of the engine. > >> I'm not entirely sure what the next step here should be. Should I go r= esearch the above, or go back and develop/test and then propose something = concrete in an OO direction and gather feedback at that point, or should w= e hash it out a bit more here on the list to get a more specific direction= to go in? > > Well, those were just my thoughts; maybe someone else will come along sh= ortly with a very different take. I'm very late on this discussion, but I think it is an interesting topic, and maybe , which I had written long ago just to check some assumptions, can serve as POC. It is certainly possible to have such a string buffer class without having to patch the engine; it could even be made available as PECL extension (first). Note that this StringBuilder uses `smart_str`s[1] what might be a good idea or not. But certainly you could use some other internal handling; interoperability with `zend_string`s[2] requires to copy the char arrays in most cases anyway, since these have a fixed length, and if these copies are reduced to a minimum (i.e. the new class has enough flexibility to work without casting to and from string), that should be bearable. Not sure if that would work for the "gd imageexportpixels() and imageimportpixels()" RFC[3], but it might be worth investigating. [1] [2] [3] Cheers, Christoph