![](https://img.php.cn/upload/image/000/000/000/1fcbe5cff89cfc660916be4979ee66a3-0.png)
RT ", but no error will be reported when using the officially recommended spprintf function to assign values and obtain the length. Why is this?
PS: In the code in the picture, if the second parameter of RETURN_STRINGL is changed to 2, the same error will be reported. I changed it to 3 because I thought PHP would include the 0 at the end, but after trying it a few times, I found that it should not be the problem here
The string returned by RETURN_STRINGL must be the memory allocated by PHP memory management. It will be released by PHP itself after the end. spprintf is the PHP memory management used. In this case, you can set the third parameter to 1, which means that PHP itself allocates the corresponding memory to copy a string.