From: lmpmbernardo at gmail dot com Operating system: Ubuntu 12.04 LTS 32 bits PHP version: 5.3.18 Package: Unknown/Other Function Bug Type: Bug Bug description:zend_parse_parameters: error when signature is s|ssbs
Description: ------------ zend_parse_parameters is having trouble parsing this signature: s|ssbs; the error happens with the last "bs" arguments. the signature "ssbs" works well. ~$ php -v PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:43) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies Test script: --------------- PHP_FUNCTION(test_parse_parameters) { char *p_str1 = ""; int p_str1_len; char *p_str2 = ""; int p_str2_len; char *p_str3 = ""; int p_str3_len; zend_bool b = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ssbs", &p_str1, &p_str1_len, &p_str2, &p_str2_len, &b, &p_str3, &p_str3_len) == FAILURE) { return; } zend_error(E_WARNING, "First parameter: len[%d] value[%s]", p_str1_len, p_str1); zend_error(E_WARNING, "Second parameter: len[%d] value[%s]", p_str2_len, p_str2); zend_error(E_WARNING, "Third parameter: '%s'", b ? "TRUE" : "FALSE"); zend_error(E_WARNING, "Fourth parameter: len[%d] value[%s]", p_str3_len, p_str3); char returnValue[256]; char* result; sprintf(returnValue, "%d#%s", 0, "houston, we have a problem!"); result = estrdup(returnValue); RETURN_STRING(result, 0); } Expected result: ---------------- lbernardo@sousel:~$ php -r 'echo test_parse_parameters("first", "second", FALSE, "fourth");' PHP Warning: First parameter: len[5] value[first] in Command line code on line 1 PHP Warning: Second parameter: len[6] value[second] in Command line code on line 1 PHP Warning: Third parameter: 'FALSE' in Command line code on line 1 PHP Warning: Fourth parameter: len[6] value[fourth] in Command line code on line 1 0#houston, we have a problem! Actual result: -------------- lbernardo@sousel:~$ php -r 'echo test_parse_parameters("first", "second", FALSE, "fourth");' PHP Warning: First parameter: len[5] value[first] in Command line code on line 1 PHP Warning: Second parameter: len[6] value[second] in Command line code on line 1 PHP Warning: Third parameter: 'TRUE' in Command line code on line 1 PHP Warning: Fourth parameter: len[769] value[(null)] in Command line code on line 1 0#houston, we have a problem! -- Edit bug report at https://bugs.php.net/bug.php?id=63535&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63535&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63535&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63535&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63535&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63535&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63535&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63535&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63535&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63535&r=support Expected behavior: https://bugs.php.net/fix.php?id=63535&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63535&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63535&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63535&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63535&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63535&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63535&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63535&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63535&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63535&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63535&r=mysqlcfg