CVS update: php3/functions
| From: | jah | Date: | Thu, 24 Sep 1998 17:09:27 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1465@lists.php.net to get a copy of this message | ||
Date: Thursday September 24, 1998 @ 13:09
Author: jah
Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv20903/functions
Modified Files:
pgsql.c
Log Message:
Fix for bug #778. Shouldn't try referencing members of a struct before checking if it's
valid.
Index: php3/functions/pgsql.c
diff -c php3/functions/pgsql.c:1.71 php3/functions/pgsql.c:1.72
*** php3/functions/pgsql.c:1.71 Sat Sep 19 17:46:10 1998
--- php3/functions/pgsql.c Thu Sep 24 13:09:25 1998
***************
*** 28,34 ****
+----------------------------------------------------------------------+
*/
! /* $Id: pgsql.c,v 1.71 1998/09/19 21:46:10 jah Exp $ */
#include <stdlib.h>
--- 28,34 ----
+----------------------------------------------------------------------+
*/
! /* $Id: pgsql.c,v 1.72 1998/09/24 17:09:25 jah Exp $ */
#include <stdlib.h>
***************
*** 591,603 ****
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
! pgsql_result = pg_result->result;
!
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
switch (entry_type) {
case PHP3_PG_NUM_ROWS:
return_value->value.lval = PQntuples(pgsql_result);
--- 591,604 ----
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
!
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
+ pgsql_result = pg_result->result;
+
switch (entry_type) {
case PHP3_PG_NUM_ROWS:
return_value->value.lval = PQntuples(pgsql_result);
***************
*** 698,710 ****
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
- pgsql_result = pg_result->result;
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
convert_to_long(field);
if (field->value.lval<0 || field->value.lval>=PQnfields(pgsql_result)) {
--- 699,711 ----
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
+ pgsql_result = pg_result->result;
convert_to_long(field);
if (field->value.lval<0 || field->value.lval>=PQnfields(pgsql_result)) {
***************
*** 763,774 ****
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
- pgsql_result = pg_result->result;
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
convert_to_string(field);
return_value->value.lval = PQfnumber(pgsql_result,field->value.str.val);
--- 764,775 ----
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
+ pgsql_result = pg_result->result;
convert_to_string(field);
return_value->value.lval = PQfnumber(pgsql_result,field->value.str.val);
***************
*** 790,801 ****
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
- pgsql_result = pg_result->result;
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
convert_to_long(row);
if (row->value.lval<0 || row->value.lval>=PQntuples(pgsql_result)) {
--- 791,802 ----
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
+ pgsql_result = pg_result->result;
convert_to_long(row);
if (row->value.lval<0 || row->value.lval>=PQntuples(pgsql_result)) {
***************
*** 841,852 ****
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
- pgsql_result = pg_result->result;
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
convert_to_long(row);
if (row->value.lval<0 || row->value.lval>=PQntuples(pgsql_result)) {
--- 842,853 ----
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
+ pgsql_result = pg_result->result;
convert_to_long(row);
if (row->value.lval<0 || row->value.lval>=PQntuples(pgsql_result)) {
***************
*** 891,902 ****
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
- pgsql_result = pg_result->result;
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
convert_to_long(row);
if (row->value.lval<0 || row->value.lval>=PQntuples(pgsql_result)) {
--- 892,903 ----
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
+ pgsql_result = pg_result->result;
convert_to_long(row);
if (row->value.lval<0 || row->value.lval>=PQntuples(pgsql_result)) {
***************
*** 957,968 ****
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
- pgsql_result = pg_result->result;
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
convert_to_long(row);
if (row->value.lval<0 || row->value.lval>=PQntuples(pgsql_result)) {
--- 958,969 ----
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
+ pgsql_result = pg_result->result;
convert_to_long(row);
if (row->value.lval<0 || row->value.lval>=PQntuples(pgsql_result)) {
***************
*** 1007,1013 ****
void php3_pgsql_free_result(INTERNAL_FUNCTION_PARAMETERS)
{
pval *result;
- PGresult *pgsql_result;
pgsql_result_handle *pg_result;
int type;
--- 1008,1013 ----
***************
*** 1020,1026 ****
RETURN_FALSE;
}
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
- pgsql_result = pg_result->result;
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
--- 1020,1025 ----
***************
*** 1044,1055 ****
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
- pgsql_result = pg_result->result;
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
return_value->value.str.val = (char *) PQoidStatus(pgsql_result);
if (return_value->value.str.val) {
return_value->value.str.len = strlen(return_value->value.str.val);
--- 1043,1054 ----
convert_to_long(result);
pg_result = (pgsql_result_handle *) php3_list_find(result->value.lval,&type);
if (type!=php3_pgsql_module.le_result) {
php3_error(E_WARNING,"%d is not a PostgresSQL result index",result->value.lval);
RETURN_FALSE;
}
+ pgsql_result = pg_result->result;
return_value->value.str.val = (char *) PQoidStatus(pgsql_result);
if (return_value->value.str.val) {
return_value->value.str.len = strlen(return_value->value.str.val);
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net