Bug #70773 [NEW]: Segmentation fault (core dumped)
| From: | svein at vip dot qq dot com | Date: | Fri, 23 Oct 2015 03:52:27 +0000 |
| Subject: | Bug #70773 [NEW]: Segmentation fault (core dumped) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-196760@lists.php.net to get a copy of this message | ||
From: svein at vip dot qq dot com
Operating system: Linux 2.6.33.15
PHP version: 7.0.0RC5
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Segmentation fault (core dumped)
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)
--
Edit bug report at https://bugs.php.net/bug.php?id=70773&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70773&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70773&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70773&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70773&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70773&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70773&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70773&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70773&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70773&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70773&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70773&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70773&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70773&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70773&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70773&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70773&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70773&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70773&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70773&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70773&r=mysqlcfg