|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-01-12 10:59 UTC] felipe@php.net
[2012-01-12 11:11 UTC] idlesign at yandex dot ru
[2012-01-12 11:11 UTC] a dot dobkin at drweb dot com
[2012-01-12 12:45 UTC] cataphract@php.net
-Status: Open
+Status: Bogus
[2012-01-12 12:45 UTC] cataphract@php.net
[2012-01-12 13:04 UTC] idlesign at yandex dot ru
[2012-01-12 14:33 UTC] anon at anon dot anon
[2012-01-13 04:43 UTC] a dot dobkin at drweb dot com
[2012-01-13 05:07 UTC] idlesign at yandex dot ru
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 22:00:02 2025 UTC |
Description: ------------ Incorrect parsing of the first parameter if it's has type of 'string' and one of next parameter has type of 'long'. Function zend_parse_parameters() always return string length as 0 of first parameter. Error is present in versions 5.3.7-5.3.9. In version 5.3.6 there is no error On php v 5.3.6 it's correctly works Example 1 (Error): PHP_FUNCTION(test_parse_parameters) { char *p_str1 = NULL; char *p_str2 = NULL; int p_long; int p_str1_len; int p_str2_len; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sls", &p_str1, &p_str1_len, &p_long, &p_str2, &p_str2_len)) { return; } zend_error(E_WARNING, "First parameter: '%s' and it len: %d", p_str1, p_str1_len); zend_error(E_WARNING, "Second parameter: '%d'", p_long); zend_error(E_WARNING, "Third parameter: '%s' and it len: %d", p_str2, p_str2_len); } Run: [antonio@antonio]# php -r 'test_parse_parameters("first", 123, "third");' Output: >>> PHP Warning: First parameter: 'first' and it len: 0 in Command line code on line 1 <<< PHP Warning: Second parameter: '123' in Command line code on line 1 PHP Warning: Third parameter: 'third' and it len: 5 in Command line code on line 1 Exemple 2 (Error): PHP_FUNCTION(test_parse_parameters) { char *p_str1 = NULL; char *p_str2 = NULL; int p_str1_len; int p_str2_len; int p_long; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssl", &p_str1, &p_str1_len, &p_str2, &p_str2_len, &p_long)) { return; } zend_error(E_WARNING, "First parameter: '%s' and it len: %d", p_str1, p_str1_len); zend_error(E_WARNING, "Second parameter: '%s' and it len: %d", p_str2, p_str2_len); zend_error(E_WARNING, "Third parameter: '%d'", p_long); } Run: [antonio@antonio]# php -r 'dwavd_init("first", "second", 123);' Output: >>> PHP Warning: First parameter: 'first' and it len: 0 in Command line code on line 1 <<< PHP Warning: Second parameter: 'second' and it len: 6 in Command line code on line 1 PHP Warning: Third parameter: '123' in Command line code on line 1 Exemple 3 (OK): PHP_FUNCTION(test_parse_parameters) { char *p_str1 = NULL; char *p_str2 = NULL; int p_str1_len; int p_str2_len; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &p_str1, &p_str1_len, &p_str2, &p_str2_len)) { return; } zend_error(E_WARNING, "First parameter: '%s' and it len: %d", p_str1, p_str1_len); zend_error(E_WARNING, "Second parameter: '%s' and it len: %d", p_str2, p_str2_len); } Run: [antonio@antonio]# php -r 'test_parse_parameters("first", "second");' Output: PHP Warning: First parameter: 'first' and it len: 5 in Command line code on line 1 PHP Warning: Second parameter: 'second' and it len: 6 in Command line code on line 1 Exemple 4 (OK): PHP_FUNCTION(test_parse_parameters) { char *p_str1 = NULL; char *p_str2 = NULL; int p_str1_len; int p_str2_len; int p_long; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lss", &p_long, &p_str1, &p_str1_len, &p_str2, &p_str2_len)) { return; } zend_error(E_WARNING, "First parameter: '%d'", p_long); zend_error(E_WARNING, "Second parameter: '%s' and it len: %d", p_str1, p_str1_len); zend_error(E_WARNING, "Third parameter: '%s' and it len: %d", p_str2, p_str2_len); } Run: [antonio@antonio]# php -r 'test_parse_parameters(123, "second", "third");' Output: PHP Warning: First parameter: '123' in Command line code on line 1 PHP Warning: Second parameter: 'second' and it len: 5 in Command line code on line 1 PHP Warning: Third parameter: 'third' and it len: 6 in Command line code on line 1