Opened 4 years ago
Last modified 4 years ago
#57423 new enhancement
we need to check an argument is closure in PclZip
| Reported by: | rpf5573 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Administration | Version: | 6.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
When we create a zip file with PclZip class, we can pass an PCLZIP_CB_PRE_ADD callback function in create function. And PclZip checks that the callback function is exist or not like below.
<?php // ----- Check that the value is a valid existing function if (!function_exists($v_function_name)) { // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'"); // ----- Return return PclZip::errorCode(); }
I want to pass a closure, but function_exists($closure_function) is false.
So how about checking the callback function is closure also like below ?
<?php // ----- Check that the value is a valid existing function if (!function_exists($v_function_name) && !($v_function_name instanceof Closure)) { // ----- Error log PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'"); // ----- Return return PclZip::errorCode(); }
Change History (1)
This ticket was mentioned in PR #3818 on WordPress/wordpress-develop by airman5573.
4 years ago
#1
- Keywords has-patch added
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
When we create a zip file with PclZip class, we can pass an PCLZIP_CB_PRE_ADD callback function in create function.
And PclZip checks that the callback function is exist or not like below.
{{{php
----- Check that the value is a valid existing function
if (!function_exists($v_function_name)) {
}
}}}
I want to pass a closure, but function_exists($closure_function) is false.
So how about checking the callback function is closure also like below ?
{{{php
----- Check that the value is a valid existing function
if (!function_exists($v_function_name) && !($v_function_name instanceof Closure)) {
}
}}}
Trac ticket: ticket