|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesmy_test (last revision 2015-10-23 03:53 UTC by svein at vip dot qq dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-10-23 04:09 UTC] laruence@php.net
[2015-10-23 12:22 UTC] laruence@php.net
-Status: Open
+Status: Feedback
[2015-11-01 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
Description: ------------ I wrote a PHP extension function my_test: PHP_FUNCTION(my_test) { long type = 0; char *function_name = NULL; int function_name_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &type ,&function_name,&function_name_len) == FAILURE) { zend_error(E_ERROR, "my_test zend_parse_parameters error"); } RETURN_LONG(1); } when i call this function in a php file php crash with Segmentation fault (core dumped) but when i modify mytest to: PHP_FUNCTION(my_test) { long type = 0; char *function_name = NULL; int function_name_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &type ,&function_name,&function_name_len) == FAILURE) { zend_error(E_ERROR, "my_test zend_parse_parameters error"); } } or PHP_FUNCTION(my_test) { long type = 0; char *function_name = NULL; int function_name_len = 0; RETURN_LONG(1); } php run ok Test script: --------------- PHP_FUNCTION(my_test) { long type = 0; char *function_name = NULL; int function_name_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &type ,&function_name,&function_name_len) == FAILURE) { zend_error(E_ERROR, "my_test zend_parse_parameters error"); } RETURN_LONG(1); } Expected result: ---------------- ok Actual result: -------------- Segmentation fault (core dumped)