|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [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-2024 The PHP Group
All rights reserved.
Last updated: Sun May 26 19:01:30 2024 UTC