mineadmin / components

mine-admin library
Apache License 2.0
10 stars 21 forks source link

没有做callback函数调用 #80

Closed develop-chen closed 1 month ago

develop-chen commented 4 months ago

image

dosubot[bot] commented 4 months ago

To address the issue of the callback function not being called within your exportExcel method, start by verifying that the callback is indeed callable at the point where you expect it to be executed. Use PHP's is_callable function for this check:

if (is_callable($callback)) {
    // Proceed with calling the callback
} else {
    // Handle the error or throw an exception
}

If the callback is confirmed to be callable but you're still encountering issues, consider the data being passed to it. Ensure that any strings, especially if they include Japanese characters or comments, are in valid UTF-8 format to prevent issues with json_encode or json_decode operations. You can check string encoding with:

if (mb_check_encoding($string, 'UTF-8')) {
    // String is valid UTF-8
} else {
    // Handle invalid UTF-8 scenario
}

Also, review the data depth and types being processed by your callback to avoid exceeding json_decode's depth limit or passing unsupported data types to json_encode.

For deeper investigation, consider using a debugging tool like Xdebug to trace the execution flow and inspect variable states. This can help identify where the process diverges from the expected behavior.

If these steps do not resolve the issue, providing more specific details about how the exportExcel function is called, any error messages, and the conditions under which the callback fails could help in offering more targeted advice.

#### Details **Sources** - [src/SecurityHttp/src/CurrentUserProxy.php](https://github.com/mineadmin/components/blob/2.0/src/SecurityHttp/src/CurrentUserProxy.php) - [src/AppStore/src/Packer/JsonPacker.php](https://github.com/mineadmin/components/blob/2.0/src/AppStore/src/Packer/JsonPacker.php)
**About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

kanyxmo commented 1 month ago

https://github.com/mineadmin/components/pull/119