Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125359 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 CA2701A00BD for ; Fri, 30 Aug 2024 10:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1725013394; bh=vIYDGpz3E49f00A5BTQNlKuE9tq/DU/rV2p/trpsOXE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ecWtTxIQRyAL2i3xWpBqVFwRmq9ArGqGvtJlUBWrOXq06b6xDCiw/31+eQox+ocVk R/HTgHaWRuLAiyBilNdM99i6eYL/P66RVoiHHel6b0ZKKT8kNYv4GtEMDzqrzMCtep u0Iz+ewdrYJhgVFd4C8+xjZEHBgkiBrObqPOMS97m13Qsv3MiM8ABPh/beALsl6PlN 8mFGrI0LLXAsVGEItx3LupiNvWF7XjqJa6121qz5pgHs7KMbXYCghwURKUQvLXVjm7 X0ki/iM5Z/U8ckNNd5ybnzc7WU+7HfoWJJlZ2g7/uexuzJ2/dr/fdGQG+0oh8xcFTa rFmgEFupgfylw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 44953180034 for ; Fri, 30 Aug 2024 10:23:12 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,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 mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 30 Aug 2024 10:23:10 +0000 (UTC) Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3df0dc53ec1so745276b6e.1 for ; Fri, 30 Aug 2024 03:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sensational.ch; s=google; t=1725013275; x=1725618075; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ozuGqpd80g81BuO3pASE8m9Ma1sB/hOamNOzTI9LoJo=; b=ZgJyYPt+oz2Fl/dAE2+UjyT3e9KZz/4/Z5BCV+NW70kCl6A5HA3kqYmavsRF75dzBh n/UrgvPb8z3KjUwYw7zEtAXW90JxD7JrEtFQ7igS+dNWR5Ujism/4WNtHkUJI0yj1G17 p782Rc3dTlUtNCQe96YJ3r5vX2D4LBxJjZa0/PTZSENfUWVFW+/eQ2bo1ABRM7ubcxjr 5gRtMuW0ZVsXZtFA1RmpEUJDYbpD2f6JfVoVd/uugl8UzMiivvzuAt5ClOCyp1EYfbg0 Tkrufl29wtv3fgv+W5dwIOmPMUxCoqjgJdZgIEfGPUiq8jBLrOgXOPHcQ0Gs9kRxpXSn 3GtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725013275; x=1725618075; h=cc:to: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=ozuGqpd80g81BuO3pASE8m9Ma1sB/hOamNOzTI9LoJo=; b=RJFD/5iLu07x+Q/7ubPltNAgTMNvbN8jyc7i1lRRHsij/8ev+irNPCBZqGWPsD6f5/ jkFrbeUVEmG9XS/n+Zx9srjPPDRLvSr4PO5ejTC/ZpKaU4T4BOJbl9brTpqc1q6gKwlM 0xJ5nXbZJWDQAyTi2Mb5Vg91n/rzbGHDhr9/H8R5rL4p/fx3eJOZeYBlAh/BKkFDpVFP wjgCCKsiMYu8KGS4noEJ4WAX7FrD2Q2ifrcsyQuhCVw2h8of+z0XsbQ9q5q/gNJ8N9+w wsMeUcBaAOsHhBe2g7qSc9vO4vnPGcMzQuI9S7Ul/ZfU3Y6c45t4qp6yP8mKgwPf0J5o /IxA== X-Gm-Message-State: AOJu0YwoYd4aBbVaNnKLuN5CQeSS8KWTqwUfdZf6I5fWHyS7xPu3F/x3 A69VFPlJWgC9Kaf89HyaeFLt28ngdpN7JBswL+Oirkp+NtaHvaP3M3fhg04y9ep5E0ScnQCHTKi Yl6YZNtSVwvBIyuLdXxwPBeURgUbvbwP2qDrMX/aAQ64IkI8N X-Google-Smtp-Source: AGHT+IHvJRA/OvlSaywdW4Mf1tn2x0GKI2CC9DwmbPnpo5kC0HNtnrcD8Uefh4t8qprJIkYoB+wJu3n0HwvGcZxN8kQ= X-Received: by 2002:a05:6808:e85:b0:3d9:dcf8:3450 with SMTP id 5614622812f47-3df05e55478mr5443109b6e.33.1725013274734; Fri, 30 Aug 2024 03:21:14 -0700 (PDT) Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Fri, 30 Aug 2024 03:21:14 -0700 Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Fri, 30 Aug 2024 03:21:11 -0700 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 (Mimestream 1.3.8) References: In-Reply-To: Date: Fri, 30 Aug 2024 03:21:14 -0700 Message-ID: Subject: Re: [PHP-DEV] json_encode() and Generators / RFC Karma To: John Coggeshall Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000007953c60620e3f33e" From: phofstetter@sensational.ch (Philip Hofstetter) --0000000000007953c60620e3f33e Content-Type: text/plain; charset="UTF-8" Hi John, On Aug 30, 2024 at 09:42:05, John Coggeshall wrote: > This seems entirely reasonable and I would welcome an RFC for it (unless > someone has a better idea as to how to handle this case). > > The other options I considered were to either materialize the Generator, but given that they can run indefinitely this seems very dangerous or json-encoding them as [] but that would be lying in most cases, so doing what serialize() does felt like the only sensible option and would prevent a nasty case of silent failure. Regards Philip --0000000000007953c60620e3f33e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi John,


On Aug 30, 2024 at 09:42:05, John= Coggeshall <john@coggenterp= rises.com> wrote:
This seems entirely reasonable and I would welcome an RFC= for it (unless someone has a better idea as to how to handle this case).

The other options I considered were to either materialize the G= enerator, but given that they can run indefinitely this seems very dangerou= s or json-encoding them as [] but that would be lying in most cases, so doi= ng what serialize() does felt like the only sensible option and would preve= nt a nasty case of silent failure.

Regards

Philip
--0000000000007953c60620e3f33e--