View Issue Details

IDProjectCategoryView StatusLast Update
0000311Xdebugpublic2007-10-04 09:33
Reportersherman Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionwon't fix 
Summary0000311: Segmentation Fault
Description

I writing simple php extension. I have crash with bellow code. Segfault occurs only with enebled xdebug:

[code]
ONPHP_METHOD(QuerySkeleton, where)
{
zval where, whereLogic, exp, logic;

if (
    zend_parse_parameters(
        ZEND_NUM_ARGS() TSRMLS_CC,
        "z|z",
        &exp,
        &logic
    )
    == FAILURE
) {
    WRONG_PARAM_COUNT;
}

if (
    Z_TYPE_P(logic) == IS_NULL
    || (ZEND_NUM_ARGS() == 1)
) {
    ZVAL_NULL(logic);
}

where = ONPHP_READ_PROPERTY(getThis(), "where");

if (
    zend_hash_num_elements(Z_ARRVAL_P(where)) != 0
    && Z_TYPE_P(logic) == IS_NULL
) {
    zend_throw_exception_ex(
        onphp_ce_WrongArgumentException,
        0 TSRMLS_CC,
        "you have to specify expression logic"
    );
    return;
} else {
    if (
        zend_hash_num_elements(Z_ARRVAL_P(where)) == 0
        && Z_TYPE_P(logic) != IS_NULL
    ) {
        ZVAL_NULL(logic);
    }

    whereLogic = ONPHP_READ_PROPERTY(getThis(), "whereLogic");

    if (Z_TYPE_P(logic) != IS_NULL)
        add_next_index_zval(whereLogic, logic);
    else
        add_next_index_null(whereLogic);

    add_next_index_zval(where, exp);
}

RETURN_ZVAL(getThis(), 1, 0);

}
[/code]

Segfault occurs in the branch:

zend_hash_num_elements(Z_ARRVAL_P(where)) != 0
&& Z_TYPE_P(logic) == IS_NULL
) {
zend_throw_exception_ex(
onphp_ce_WrongArgumentException,
0 TSRMLS_CC,
"you have to specify expression logic"
);
return;
}

Exception does not throw.

Without xdebug code work correctly.

Full Version of class here:

http://svn.shadanakar.org/filedetails.php?repname=onPHP&path=%2Ftrunk%2Fext%2Fsrc%2Fcore%2FOSQL%2FQuerySkeleton.c&rev=4300

Additional Information

php version:
PHP 5.2.4_pre200708051230-pl2-gentoo (cli) (built: Aug 19 2007 02:53:50)

TagsNo tags attached.
Operating Systemgentoo
PHP Version5.2-dev

Activities

derick

2007-10-04 09:33

administrator   ~0000734

I will not debug your extension for you. If you can explain to me why (and how) this is Xdebug's fault - please reopen.

Issue History

Date Modified Username Field Change
2007-09-28 22:07 sherman New Issue
2007-10-04 09:33 derick Status new => resolved
2007-10-04 09:33 derick Resolution open => won't fix
2007-10-04 09:33 derick Assigned To => derick
2007-10-04 09:33 derick Note Added: 0000734
2016-07-31 12:35 derick Category Debug client (console) => debugclient (debugging tool)
2016-07-31 12:35 derick Category debugclient (debugging tool) => (No Category)