Edit report at https://bugs.php.net/bug.php?id=65542&edit=1

 ID:                 65542
 Updated by:         johan...@php.net
 Reported by:        Azq2 at ya dot ru
 Summary:            zend_parse_parameters return string length == 0
 Status:             Not a bug
 Type:               Bug
 Package:            Unknown/Other Function
 PHP Version:        5.5.3
 Block user comment: N
 Private report:     N

 New Comment:

Given that zend_parse_parameters work in about 3000 places in PHP and tons of 
other extensions it is unlikely that this is the cause of the issue. Have you 
run a memory checker (valgrind etc.)?

Unless there is compilable code which proves this is a PHP issue this is Not a 
Bug.

As said: For support writing PHP extensions please write the pecl-dev list 
(pecl-dev at lists.php.net), but that also requires compilable code for useful 
help.


Previous Comments:
------------------------------------------------------------------------
[2013-08-24 22:31:38] azq2 at ya dot ru

But if use zval - length works

------------------------------------------------------------------------
[2013-08-24 21:58:02] Azq2 at ya dot ru

NOT, ITS BUG. 


CODE: 
PHP_METHOD(Mysql, connect) {
        bool return_state = true; 
        bool persistent = false; 
        char *addr, *user, *password, *db, *connect_id = NULL, *socket = NULL, 
*host = NULL; 
        int addr_length=0, user_length, password_length, db_length, 
connect_id_length = 0; 
        uint socket_length = 0, host_length = 0; 
        unsigned short port = 0; 
        unsigned long flags = 0; 
        
        zval *object = getThis(); 
        php_mysql_object *obj = (php_mysql_object 
*)zend_object_store_get_object(object TSRMLS_CC); 
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssssl|bl", &addr, 
&addr_length, &user, &user_length, &password, &password_length, &db, 
&db_length, 
&port, &persistent, &flags) != SUCCESS)
                WRONG_PARAM_COUNT; 
        
        printf("addr(%d)     = %s\n", addr_length, addr); 
        printf("user(%d)     = %s\n", user_length, user); 
        printf("password(%d) = %s\n", password_length, password); 
        printf("db(%d)       = %s\n", db_length, db); 
        

php code: 
$db -> connect("127.0.0.2", "root", "qwerty", "test", 1); 


Returns: 
addr(0)     = 127.0.0.2
user(0)     = root
password(6) = qwerty
db(4)       = test

------------------------------------------------------------------------
[2013-08-24 21:33:05] johan...@php.net

String lengths in PHP are int not uint.

Still 0 would be an unlikely result, but string length handling works in a few 
hundred other functions flawlessly so it's likely a bug in your code. As this 
is no support forum please take this somewhere else. (The pecl-dev list might 
be a good place if you share a bit more code)

------------------------------------------------------------------------
[2013-08-24 21:06:30] azq2 at ya dot ru

But... password and db - is ok.

------------------------------------------------------------------------
[2013-08-24 21:05:08] Azq2 at ya dot ru

char *addr, *user, *password, *db, *connect_id = NULL, *socket = NULL, *host = 
NULL; 
uint addr_length, user_length, password_length, db_length, connect_id_length = 
0;

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=65542


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65542&edit=1

Reply via email to