Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110276 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 74088 invoked from network); 26 May 2020 14:16:13 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 May 2020 14:16:13 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D087E1804F6 for ; Tue, 26 May 2020 05:56:24 -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=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 26 May 2020 05:56:24 -0700 (PDT) Received: by mail-oi1-f180.google.com with SMTP id s198so18548309oie.6 for ; Tue, 26 May 2020 05:56:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Zt0TLnd9gdB9qBQpfCJUQBKvl408bACmvl/Ik4xHOWk=; b=KlGoJCWPWmotLB6otNBxo2QuA+ByiG3F0PyomG2ccldset3fh52upet2fMAdzG6olu gKi8IMRVN9hk8sbAtDowq3Vsu8en81xNb44yUHsua1/rFIMMwXYyy8xVldtTnKjGAkTe bhfPIdx8JynzGBshne8ahIGmEGM4KcZmz83sz+KZrnkpIwoVzGliY+7CfRthXOjBVwFz 7bNPi7KD5/WZsU7pkRz/WhI9ty6vDpvwAih/MhC2kl3XK4DrWd7WOIYzdJyHTv2Ta/bv MdlUTNWzn8hxuyJGFfTQKj+BvKZZVAE+O2UYGdas8Y0oKZqBCBvPZx57xxBoafo72944 XgNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Zt0TLnd9gdB9qBQpfCJUQBKvl408bACmvl/Ik4xHOWk=; b=AQ/lZHoOuZ2V0ay3IZMofcHdL36WdV+u9YY/CGEGTkrBKUQmZATZAorrmOOqnAiRvp MrPgXM7xfv1JFelGRPXbzkj51rNftbHu3qCzfzuCHLwLGIxlYw+RhPrNbqwIyA1HOWDw hEaIqPoNh3yHeULxf5mXq2BhU1PaKfkzpVsALPOHtZG9h2OX8j2VhcvH04EyhsVLmWFp eywofdHvNnGeubceRTFH2AgDoD8I/wQsD+q3QCVA14CqUUTEV92NhGe/S8Rhyri3+bdE MaO9dk9CDqSxf1r3PiRF8I5U/XniasNiaUI8sqDXni6PNQ1/Cw/rYSBEtuRSE143tC4i C0/w== X-Gm-Message-State: AOAM532BPuOvFRRdSSi/Vb+YenvPKR/RWoaaJY0ziBRMgPJIcUiu7PfO mpiLSILDKfbSzN+ObGOGjHIP9yMqpuEGoFlOqKjpPA2/SDw= X-Google-Smtp-Source: ABdhPJwmhbR6BOMHoRUdJVxzr/Wrm5PFCmEtp0+jzNEl8futPBplgIgdkDgyo3fPQPbMgb4CkUKhINB8WQ3uEM1Hai8= X-Received: by 2002:aca:4a50:: with SMTP id x77mr14120326oia.138.1590497782992; Tue, 26 May 2020 05:56:22 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 26 May 2020 09:56:10 -0300 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="0000000000005f146205a68c9fe7" Subject: Improvement to errors From: david.proweb@gmail.com (David Rodrigues) --0000000000005f146205a68c9fe7 Content-Type: text/plain; charset="UTF-8" Hello! I've been thinking that some errors in PHP are very difficult to understand. Especially when we use two equal functions with different arguments on the same line. The error does not make it clear where the error is. $strVariable = 'hello'; $nullVariable = null; return strlen($strVariable) - strlen($nullVariable); The second strlen() will causes an error: "strlen() expects parameter 1 to be string, null given - line 107". So I thought of two possible solutions: 1. Improve the error description, displaying parameters and information that are easy to reuse (eg. variables). - "strlen($nullVariable) expects parameter 1 to be string, null given - line 107" 2. Indicate the offset from where the function was called, along with the line (which already exists). - "strlen() expects parameter 1 to be string, null given - line 107:30" I believe that the second solution is the simplest to be implemented and already solves the problem enough. Atenciosamente, David Rodrigues --0000000000005f146205a68c9fe7--