Edit report at https://bugs.php.net/bug.php?id=65542&edit=1
ID: 65542 Comment by: azq2 at ya dot ru 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: Problem solved. I noob :D Previous Comments: ------------------------------------------------------------------------ [2013-08-25 07:13:00] azq2 at ya dot ru azq2@zhumarin:/var/www/zhumarin-test.ru/core/native$ valgrind --tool=memcheck -- num-callers=30 php scripts/test.php ==9991== Memcheck, a memory error detector ==9991== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==9991== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==9991== Command: php scripts/test.php ==9991== addr(9) = 127.0.0.2 user(4) = root password(6) = qwerty db(4) = test Warning: var_dump() expects at least 1 parameter, 0 given in /var/www/zhumarin- test.ru/core/native/scripts/test.php on line 5 ... ==9991== ==9991== HEAP SUMMARY: ==9991== in use at exit: 104,605 bytes in 2,642 blocks ==9991== total heap usage: 25,435 allocs, 22,793 frees, 3,914,280 bytes allocated ==9991== ==9991== LEAK SUMMARY: ==9991== definitely lost: 248 bytes in 1 blocks ==9991== indirectly lost: 10,604 bytes in 6 blocks ==9991== possibly lost: 0 bytes in 0 blocks ==9991== still reachable: 93,753 bytes in 2,635 blocks ==9991== suppressed: 0 bytes in 0 blocks ==9991== Rerun with --leak-check=full to see details of leaked memory ==9991== ==9991== For counts of detected and suppressed errors, rerun with: -v ==9991== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2) ------------------------------------------------------------------------ [2013-08-24 23:22:26] johan...@php.net 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. ------------------------------------------------------------------------ [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) ------------------------------------------------------------------------ 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