Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123870 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 49CBC1A009C for ; Wed, 26 Jun 2024 14:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719411190; bh=Ae2GtW/Nk1mK4A2SO7zmcOIdPnxjONq5BDHt9NjmWMY=; h=From:Date:Subject:To:From; b=YfYbhJTeSmtUFOiS8w8sBNS2sZPIjIA0ONp6vIXr7ZVAwEBhCWR4XQERxH6ytYq5I GYGs7hHdHx3lROUM3WZ8sj5ftn+mOPmpl5lByDZ+t4OmOGPYvXZVi5nSKdSY9zP7b2 ddxoRkimgP0MHI7NiUq6T8DfScPydomfCCcOn6ZgSSPvW3z5UUDAWwifxzh9nQ9yqJ cUOA3LCS5++gf6cNEvdKCBiHCAJtIdMN0VIJLg+LxEmIBXNHHxamlkvShAOg2cJeIV 893pXIBylljuxgA54id08lQBQMZkUXPNY3zViCbXUB4alXdsnepjdr/AmZ5xyy8NqE Ls8K6rEmiAjDw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BDD0D180077 for ; Wed, 26 Jun 2024 14:13:09 +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_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) (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 ; Wed, 26 Jun 2024 14:13:06 +0000 (UTC) Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-80f4fc0f0aeso1694764241.0 for ; Wed, 26 Jun 2024 07:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719411108; x=1720015908; darn=lists.php.net; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Ae2GtW/Nk1mK4A2SO7zmcOIdPnxjONq5BDHt9NjmWMY=; b=mGYmOphqyWpJUG9Y1nI29f7XBhnipgQWPXowsTYG1Zcs3oGqLJD5dHATvc8iAXVMBd b1+oNDXRK7sMOFfL5/nD9NMN2xH6WnBQd0K/zCXNZzMKH0cQgQB4rXMrU3v0y7+8t6Rn JXKl4G2pa9zeje73Sl/f2GPPRlmO0Jmi5KuA/+2yWUj3DW7arkJfy4sSA7YTutAKsxm/ iWrLFq8Pt+PoBRUO9STFRdHiXdh2Eer0IL5ai91VkFhnrEwol6lvRWuiCiWVgoQyDR2V kp3M6iVXmBo2mtfwIvAOhbS5INnIKcf25e4meVUaocdZoYqJzWqn0d7ZOGG+kqc5rk68 0CTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719411108; x=1720015908; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Ae2GtW/Nk1mK4A2SO7zmcOIdPnxjONq5BDHt9NjmWMY=; b=sGj4B4GEoK5ZYYgcExJl/Scyw703nZBAVZI5863ynyjwVMb8aFYLzvIHBHfs6izKjT OfsrOaaLd411WJtruIA57Y265cXYHVj+aaHYgSkrAJnJszyU+hudNTvcEp1pcQxJVg99 Gpve1goV+pDxfL1JTameNrh9IGExkDfcIQgew0ZZFEKqZYYgH05AcLYHB6JNqPXmiFJO OqNIdwnGbI0IhHUuACR4Vab66IjJpkrXpGlRb+XJff6fwc0Erye6moTdy3lGq+NCB4fT 19jx4Sd81hJLmaFKgHcoqhCqM1fclPP7TaPIZXSTUd4ExqT/tIcEmh0lz52MPQ+/wTmH OHyw== X-Gm-Message-State: AOJu0Yzi+I29/dfeMpU4ef6q0EwxFUk2ol5yNbQQ6LR2VxntoaWQQF5l 4KwQwsCebjqc51ScD8p3/SxczNzoeI56fUqQAOOEsllVLcZSMzdJ1ZRozlGCfDBHIdSoGeQ2PQX Nuwtz+Xm/9hnn525/t4kVndbEhkOzmuaM X-Google-Smtp-Source: AGHT+IGMy9VY6glQsQE1V+eVOBPaq3bqHc3ACVS2rS1hxws0HgOZVd+lL5YY8oeEBAWkr6ICzPXShQT1V2EqtcDIqo8= X-Received: by 2002:a05:6122:202a:b0:4ef:5e3f:599a with SMTP id 71dfb90a1353d-4ef6d8baf8emr9565347e0c.14.1719411107825; Wed, 26 Jun 2024 07:11:47 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Date: Wed, 26 Jun 2024 11:11:38 -0300 Message-ID: Subject: [PHP-DEV] [RFC][Discussion] Enhance JSON error messages To: PHP Internals List Content-Type: text/plain; charset="UTF-8" From: dev.juan.morales@gmail.com (juan carlos morales) Hello Internals. I'm here to discuss an improvement in error messages when dealing with JSON in PHP. After watching Derick Rethans speak at the UK PHP Conference: https://youtu.be/3U0DGhzSH2U?feature=shared&t=2483 I also think it would be very useful to have better error messages. At the moment, we get things like "Syntax Error" ... period, no clue where the JSON is corrupt or anything else. With big JSONs is very cumberstone to get to the line and character position where the JSON is corrupt .... for example. I am already working in a change that would improve error messages while working with JSONs. What I am very close to achieve is to have error messages like "Syntax Error - at character position X near content Y" .... something like that. I already know that I can do it, actually there is a Work In Progress Pull Request for this : https://github.com/php/php-src/pull/14672 I repeat, is work in progress. BUT it can be done. Maybe my approach is not the best ... but one way or another .... it can be done. Please let me know your ideas, thoughts about this. Please, dont kill me for the actual code, is WIP. Thanks in advance to everyone. Juan