com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/pdo/pdo _stmt.c

From: Date: Tue, 12 Jul 2016 09:17:36 +0000
Subject: com php-src: Merge branch 'PHP-5.6' into PHP-7.0: ext/pdo/pdo _stmt.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92956@lists.php.net to get a copy of this message
Commit: ec285762605e5fdda747f2c9923609be8c4e7354 Author: Julien Pauli <jpauli@php.net> Tue, 12 Jul 2016 11:17:36 +0200 Parents: 932191a6ed93ec2f10c78a866775f6fc750fad96 17d4f5c2f83469764de63b221d2314ac3443d8db Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ec285762605e5fdda747f2c9923609be8c4e7354 Log: Merge branch 'PHP-5.6' into PHP-7.0 * PHP-5.6: Updated NEWS Fixes #52384: Adds parameter value to dumped output. Also adds output flag indicating presence of PDO::PARAM_INPUT_OUTPUT. Conflicts: ext/pdo/pdo_stmt.c Bugs: https://bugs.php.net/52384 Changed paths: MM ext/pdo/pdo_stmt.c Diff: diff --cc ext/pdo/pdo_stmt.c index fdf5415,2c089f1..3437869 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@@ -2118,23 -2144,54 +2118,58 @@@ static PHP_METHOD(PDOStatement, debugDu stmt->bound_params ? zend_hash_num_elements(stmt->bound_params) : 0); if (stmt->bound_params) { - zend_hash_internal_pointer_reset_ex(stmt->bound_params, &pos); - while (SUCCESS == zend_hash_get_current_data_ex(stmt->bound_params, - (void**)&param, &pos)) { - char *str; - uint len; - ulong num; - int res; - - res = zend_hash_get_current_key_ex(stmt->bound_params, &str, &len, &num, 0, &pos); - if (res == HASH_KEY_IS_LONG) { - php_stream_printf(out TSRMLS_CC, "Key: Position #%ld:\n", num); - } else if (res == HASH_KEY_IS_STRING) { - php_stream_printf(out TSRMLS_CC, "Key: Name: [%d] %.*s\n", len, len, str); + zend_ulong num; + zend_string *key = NULL; ++ zval parameter; + ZEND_HASH_FOREACH_KEY_PTR(stmt->bound_params, num, key, param) { + if (key) { + php_stream_printf(out, "Key: Name: [%zd] %.*s\n", + ZSTR_LEN(key), (int) ZSTR_LEN(key), ZSTR_VAL(key)); + } else { + php_stream_printf(out, "Key: Position #%pd:\n", num); } - php_stream_printf(out, "paramno=%pd\nname=[%zd] \"%.*s\"\nis_param=%d\nparam_type=%d\n", - php_stream_printf(out TSRMLS_CC, "paramno=%ld\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\nis_input_output=%d\n", - param->paramno, param->namelen, param->namelen, param->name ? param->name : "", - param->is_param, - PDO_PARAM_TYPE(param->param_type), - (param->param_type & PDO_PARAM_INPUT_OUTPUT) == PDO_PARAM_INPUT_OUTPUT); ++ php_stream_printf(out, "paramno=%pd\nname=[%zd] \"%.*s\"\nis_param=%d\nparam_type=%d\nis_input_output=%d\n", + param->paramno, param->name ? ZSTR_LEN(param->name) : 0, param->name ? (int) ZSTR_LEN(param->name) : 0, + param->name ? ZSTR_VAL(param->name) : "", + param->is_param, - param->param_type); ++ PDO_PARAM_TYPE(param->param_type), ++ (param->param_type & PDO_PARAM_INPUT_OUTPUT) == PDO_PARAM_INPUT_OUTPUT); + + /* + * Check the type of the parameter and print out the value. + * + * Most are self explanatory with the following exceptions: + * PDO::PARAM_INT evaluates to a long + * PDO::PARAM_LOB evaluates to a string + */ - switch (Z_TYPE_P(param->parameter)) { - case IS_BOOL: - php_stream_printf(out TSRMLS_CC, "param_value=%s\n", Z_BVAL_P(param->parameter)?"true":"false"); ++ parameter = param->parameter; ++again: ++ switch (Z_TYPE(parameter)) { ++ case IS_REFERENCE: ++ parameter = *Z_REFVAL(parameter); ++ goto again; ++ case IS_TRUE: ++ php_stream_printf(out, "param_value=true\n"); ++ break; ++ case IS_FALSE: ++ php_stream_printf(out, "param_value=false\n"); + break; + case IS_NULL: - php_stream_printf(out TSRMLS_CC, "param_value=null\n"); ++ php_stream_printf(out, "param_value=null\n"); + break; + case IS_LONG: - php_stream_printf(out TSRMLS_CC, "param_value=%ld\n", Z_LVAL_P(param->parameter)); ++ php_stream_printf(out, "param_value=%ld\n", Z_LVAL(parameter)); + break; + case IS_STRING: - php_stream_printf(out TSRMLS_CC, "param_value=%s\n", Z_STRVAL_P(param->parameter)); ++ php_stream_printf(out, "param_value=%s\n", Z_STRVAL(parameter)); + break; + default: - php_stream_printf(out TSRMLS_CC, "param_value=unknown\n"); ++ php_stream_printf(out, "param_value=unknown\n"); + break; + } - zend_hash_move_forward_ex(stmt->bound_params, &pos); - } + } ZEND_HASH_FOREACH_END(); } php_stream_close(out);

« previous php.cvs (#92956) next »