mirror of
https://github.com/php/php-src.git
synced 2024-11-28 20:34:29 +08:00
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: Add to NEWS Add to NEWS Fix for bug #68087 (ODBC not reading DATE columns correctly) Add to NEWS Add to NEWS Fix for bug #68114 (Build fails on OS X due to undefined symbols) Micro optimization Improved return by reference handling
This commit is contained in:
commit
9af9f874c7
@ -1427,11 +1427,11 @@ static zend_always_inline void i_init_func_execute_data(zend_execute_data *execu
|
||||
{
|
||||
uint32_t first_extra_arg, num_args;
|
||||
ZEND_ASSERT(EX(func) == (zend_function*)op_array);
|
||||
ZEND_ASSERT(EX(scope) == EG(scope));
|
||||
|
||||
EX(opline) = op_array->opcodes;
|
||||
EX(call) = NULL;
|
||||
EX(return_value) = return_value;
|
||||
EX(scope) = EG(scope);
|
||||
EX(delayed_exception) = NULL;
|
||||
EX(silence_op_num) = -1;
|
||||
|
||||
@ -1637,6 +1637,7 @@ ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data
|
||||
}
|
||||
|
||||
EX(symbol_table) = NULL;
|
||||
EX(scope) = EG(scope);
|
||||
|
||||
i_init_func_execute_data(execute_data, op_array, return_value TSRMLS_CC);
|
||||
|
||||
|
@ -2698,17 +2698,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
|
||||
ZEND_VM_C_GOTO(fcall_end);
|
||||
}
|
||||
} else if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
|
||||
zval *return_value = NULL;
|
||||
|
||||
EG(scope) = fbc->common.scope;
|
||||
call->symbol_table = NULL;
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
return_value = EX_VAR(opline->result.var);
|
||||
|
||||
ZVAL_NULL(return_value);
|
||||
Z_VAR_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
}
|
||||
|
||||
call->scope = EG(scope) = fbc->common.scope;
|
||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC);
|
||||
@ -2718,6 +2708,16 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
|
||||
|
||||
zend_vm_stack_free_call_frame(call TSRMLS_CC);
|
||||
} else {
|
||||
zval *return_value = NULL;
|
||||
|
||||
call->symbol_table = NULL;
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
return_value = EX_VAR(opline->result.var);
|
||||
|
||||
ZVAL_NULL(return_value);
|
||||
Z_VAR_FLAGS_P(return_value) = 0;
|
||||
}
|
||||
|
||||
call->prev_execute_data = execute_data;
|
||||
i_init_func_execute_data(call, &fbc->op_array, return_value TSRMLS_CC);
|
||||
|
||||
@ -2842,6 +2842,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
|
||||
}
|
||||
} else {
|
||||
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (OP1_TYPE != IS_TMP_VAR) {
|
||||
zval_opt_copy_ctor_no_imm(EX(return_value));
|
||||
}
|
||||
@ -2862,6 +2863,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EX(return_value)) {
|
||||
ZVAL_NEW_REF(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
|
||||
}
|
||||
break;
|
||||
@ -2872,6 +2874,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY)
|
||||
ZVAL_MAKE_REF(retval_ptr);
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
|
@ -580,17 +580,7 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
goto fcall_end;
|
||||
}
|
||||
} else if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
|
||||
zval *return_value = NULL;
|
||||
|
||||
EG(scope) = fbc->common.scope;
|
||||
call->symbol_table = NULL;
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
return_value = EX_VAR(opline->result.var);
|
||||
|
||||
ZVAL_NULL(return_value);
|
||||
Z_VAR_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
|
||||
}
|
||||
|
||||
call->scope = EG(scope) = fbc->common.scope;
|
||||
if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC);
|
||||
@ -600,6 +590,16 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
zend_vm_stack_free_call_frame(call TSRMLS_CC);
|
||||
} else {
|
||||
zval *return_value = NULL;
|
||||
|
||||
call->symbol_table = NULL;
|
||||
if (RETURN_VALUE_USED(opline)) {
|
||||
return_value = EX_VAR(opline->result.var);
|
||||
|
||||
ZVAL_NULL(return_value);
|
||||
Z_VAR_FLAGS_P(return_value) = 0;
|
||||
}
|
||||
|
||||
call->prev_execute_data = execute_data;
|
||||
i_init_func_execute_data(call, &fbc->op_array, return_value TSRMLS_CC);
|
||||
|
||||
@ -2648,6 +2648,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
|
||||
}
|
||||
} else {
|
||||
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (IS_CONST != IS_TMP_VAR) {
|
||||
zval_opt_copy_ctor_no_imm(EX(return_value));
|
||||
}
|
||||
@ -2668,6 +2669,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EX(return_value)) {
|
||||
ZVAL_NEW_REF(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
|
||||
}
|
||||
break;
|
||||
@ -2678,6 +2680,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND
|
||||
ZVAL_MAKE_REF(retval_ptr);
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
@ -9474,6 +9477,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
|
||||
}
|
||||
} else {
|
||||
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (IS_TMP_VAR != IS_TMP_VAR) {
|
||||
zval_opt_copy_ctor_no_imm(EX(return_value));
|
||||
}
|
||||
@ -9494,6 +9498,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EX(return_value)) {
|
||||
ZVAL_NEW_REF(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
|
||||
}
|
||||
break;
|
||||
@ -9504,6 +9509,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE
|
||||
ZVAL_MAKE_REF(retval_ptr);
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
@ -16036,6 +16042,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
|
||||
}
|
||||
} else {
|
||||
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (IS_VAR != IS_TMP_VAR) {
|
||||
zval_opt_copy_ctor_no_imm(EX(return_value));
|
||||
}
|
||||
@ -16056,6 +16063,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EX(return_value)) {
|
||||
ZVAL_NEW_REF(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
|
||||
}
|
||||
break;
|
||||
@ -16066,6 +16074,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE
|
||||
ZVAL_MAKE_REF(retval_ptr);
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
@ -33680,6 +33689,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
|
||||
}
|
||||
} else {
|
||||
ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (IS_CV != IS_TMP_VAR) {
|
||||
zval_opt_copy_ctor_no_imm(EX(return_value));
|
||||
}
|
||||
@ -33700,6 +33710,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
|
||||
zend_error(E_NOTICE, "Only variable references should be returned by reference");
|
||||
if (EX(return_value)) {
|
||||
ZVAL_NEW_REF(EX(return_value), retval_ptr);
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
|
||||
}
|
||||
break;
|
||||
@ -33710,6 +33721,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER
|
||||
ZVAL_MAKE_REF(retval_ptr);
|
||||
Z_ADDREF_P(retval_ptr);
|
||||
ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
|
||||
Z_VAR_FLAGS_P(EX(return_value)) = IS_VAR_RET_REF;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
|
@ -58,12 +58,17 @@ dnl
|
||||
AC_CACHE_CHECK([whether whether compiler supports Decimal32/64/128 types], ac_cv_decimal_fp_supported,[
|
||||
AC_TRY_RUN( [
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
typedef float dec32 __attribute__((mode(SD)));
|
||||
dec32 k = 99.49f;
|
||||
double d2 = (double)k;
|
||||
return 0;
|
||||
const char *check_str = "99.49";
|
||||
char print_str[32];
|
||||
|
||||
snprintf(print_str, 32, "%f", d2);
|
||||
return memcmp(print_str, check_str, 5);
|
||||
}
|
||||
],[
|
||||
ac_cv_decimal_fp_supported=yes
|
||||
|
@ -939,14 +939,15 @@ int odbc_bindcols(odbc_result *result TSRMLS_DC)
|
||||
SQLUSMALLINT colfieldid;
|
||||
int charextraalloc;
|
||||
|
||||
colfieldid = SQL_COLUMN_DISPLAY_SIZE;
|
||||
charextraalloc = 0;
|
||||
result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0);
|
||||
|
||||
result->longreadlen = ODBCG(defaultlrl);
|
||||
result->binmode = ODBCG(defaultbinmode);
|
||||
|
||||
for(i = 0; i < result->numcols; i++) {
|
||||
charextraalloc = 0;
|
||||
colfieldid = SQL_COLUMN_DISPLAY_SIZE;
|
||||
|
||||
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME,
|
||||
result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0);
|
||||
rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE,
|
||||
|
57
ext/odbc/tests/bug68087.phpt
Normal file
57
ext/odbc/tests/bug68087.phpt
Normal file
@ -0,0 +1,57 @@
|
||||
--TEST--
|
||||
odbc_exec(): Getting accurate date data from query
|
||||
--SKIPIF--
|
||||
<?php include 'skipif.inc'; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include 'config.inc';
|
||||
|
||||
$id_1_date = '2014-09-23';
|
||||
$id_2_date = '2014-09-24';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
|
||||
|
||||
odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL VARCHAR(100), DATE_COL DATE)');
|
||||
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (1, 'hello', '$id_1_date')");
|
||||
odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL, DATE_COL) VALUES (2, 'helloagain', '$id_2_date')");
|
||||
|
||||
$res = odbc_exec($conn, 'SELECT * FROM FOO ORDER BY ID ASC');
|
||||
|
||||
while(odbc_fetch_row($res)) {
|
||||
$id = odbc_result($res, "ID");
|
||||
$varchar_col = odbc_result($res, "VARCHAR_COL");
|
||||
$date = odbc_result($res, "DATE_COL");
|
||||
|
||||
if ($id == 1) {
|
||||
if ($date != $id_1_date) {
|
||||
print "Date_1 mismatched\n";
|
||||
} else {
|
||||
print "Date_1 matched\n";
|
||||
}
|
||||
} else {
|
||||
if ($date != $id_2_date) {
|
||||
print "Date_2 mismatched\n";
|
||||
} else {
|
||||
print "Date_2 matched\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Date_1 matched
|
||||
Date_2 matched
|
||||
--CLEAN--
|
||||
<?php
|
||||
include 'config.inc';
|
||||
|
||||
$conn = odbc_connect($dsn, $user, $pass);
|
||||
|
||||
odbc_exec($conn, 'DROP TABLE FOO');
|
||||
odbc_exec($conn, 'DROP DATABASE odbcTEST');
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user