|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78170 Missing Z_PARAM_OPTIONAL results in a TypeError with incorrect message
Submitted: 2019-06-14 22:06 UTC Modified: 2019-06-30 04:22 UTC
From: Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 7.4Git-2019-06-14 (Git) OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-06-14 22:06 UTC]
When a function has optional parameters, the use of `Z_PARAM_OPTIONAL` is required. Forgetting to add this macro leads to a `TypeError` with a message about the given required argument instead of the missing argument.

Test script:
    zend_long code;
    char *phrase;
    size_t phrase_len;

        Z_PARAM_STRING(phrase, phrase_len)



Expected result:
Fatal error: Uncaught TypeError: test_it() expects parameter 2 to be string, null given

Actual result:
Fatal error: Uncaught TypeError: test_it() expects parameter 1 to be integer, integer given


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-14 22:20 UTC]
Are you using a debug build? There are assertions that are supposed to catch this:
 [2019-06-21 15:11 UTC]
-Status: Open +Status: Feedback
 [2019-06-30 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 02 03:05:53 2022 UTC