X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pqconn.c;h=f66ae0cb0a3d275401d01c27595b3d6b52cd5d38;hp=f2a0e0ca8005bf8a5b4fc40664bc11a7b075d742;hb=25e7c9331c023ef1ca869b2f1c8433251bc8f359;hpb=b00e81afafdb7bc6e76b6ef4d283f5b5fb8feec7 diff --git a/src/php_pqconn.c b/src/php_pqconn.c index f2a0e0c..f66ae0c 100644 --- a/src/php_pqconn.c +++ b/src/php_pqconn.c @@ -1146,11 +1146,12 @@ static PHP_METHOD(pqconn, getResult) { throw_exce(EX_UNINITIALIZED, "pq\\Connection not initialized"); } else { PGresult *res = PQgetResult(obj->intern->conn); + php_pq_object_t *res_obj; - if (!res) { - RETVAL_NULL(); + if (res && (res_obj = PQresultInstanceData(res, php_pqconn_event))) { + php_pq_object_to_zval_no_addref(res_obj, return_value); } else { - php_pq_object_to_zval_no_addref(PQresultInstanceData(res, php_pqconn_event), return_value); + RETVAL_NULL(); } php_pqconn_notify_listeners(obj); @@ -1570,7 +1571,7 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_escape_bytea, 0, 0, 1) ZEND_END_ARG_INFO(); static PHP_METHOD(pqconn, escapeBytea) { char *str; - int len; + size_t len; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &len)) { php_pqconn_object_t *obj = PHP_PQ_OBJ(getThis(), NULL);