|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-11-16 00:47 UTC] lmpmbernardo at gmail dot com
-PHP Version: 5.3.18
+PHP Version: 5.3.10
[2012-11-16 00:47 UTC] lmpmbernardo at gmail dot com
[2012-11-16 01:28 UTC] felipe@php.net
-Status: Open
+Status: Not a bug
[2012-11-16 01:28 UTC] felipe@php.net
[2012-11-16 13:34 UTC] lmpmbernardo at gmail dot com
[2012-11-16 22:14 UTC] nikic@php.net
[2012-11-16 23:18 UTC] lmpmbernardo at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 16:00:01 2025 UTC |
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!