From 8e49bacf953635139f9a2621f3ea0a6e7c394740 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 24 Nov 2005 16:21:43 +0000 Subject: [PATCH] Fixed bug #35358 (Incorrect error messages for PDO class constants). --- NEWS | 1 + ext/pdo/pdo_dbh.c | 10 +++++----- ext/pdo/pdo_stmt.c | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 893fe44a08..a10104671f 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ PHP NEWS frame was called from an object. (Sebastian) - Fixed bug #35360 (exceptions in interactive mode (php -a) may cause crash). (Dmitry) +- Fixed bug #35358 (Incorrect error messages for PDO class constants). (Ilia) 24 Nov 2005, PHP 5.1 - Added support for class constants and static members for internal classes. diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index bd12a1eaed..883f98defc 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -508,7 +508,7 @@ static PHP_METHOD(PDO, prepare) || zend_lookup_class(Z_STRVAL_PP(item), Z_STRLEN_PP(item), &pce TSRMLS_CC) == FAILURE ) { pdo_raise_impl_error(dbh, NULL, "HY000", - "PDO_ATTR_STATEMENT_CLASS requires format array(classname, ctor_args); " + "PDO::ATTR_STATEMENT_CLASS requires format array(classname, ctor_args); " "the classname must be a string specifying an existing class" TSRMLS_CC); PDO_HANDLE_DBH_ERR(); @@ -530,7 +530,7 @@ static PHP_METHOD(PDO, prepare) if (zend_hash_index_find(Z_ARRVAL_PP(opt), 1, (void**)&item) == SUCCESS) { if (Z_TYPE_PP(item) != IS_ARRAY) { pdo_raise_impl_error(dbh, NULL, "HY000", - "PDO_ATTR_STATEMENT_CLASS requires format array(classname, ctor_args); " + "PDO::ATTR_STATEMENT_CLASS requires format array(classname, ctor_args); " "ctor_args must be an array" TSRMLS_CC); PDO_HANDLE_DBH_ERR(); @@ -717,7 +717,7 @@ static PHP_METHOD(PDO, setAttribute) if (dbh->is_persistent) { pdo_raise_impl_error(dbh, NULL, "HY000", - "PDO_ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances" + "PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances" TSRMLS_CC); PDO_HANDLE_DBH_ERR(); RETURN_FALSE; @@ -728,7 +728,7 @@ static PHP_METHOD(PDO, setAttribute) || zend_lookup_class(Z_STRVAL_PP(item), Z_STRLEN_PP(item), &pce TSRMLS_CC) == FAILURE ) { pdo_raise_impl_error(dbh, NULL, "HY000", - "PDO_ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); " + "PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); " "the classname must be a string specifying an existing class" TSRMLS_CC); PDO_HANDLE_DBH_ERR(); @@ -754,7 +754,7 @@ static PHP_METHOD(PDO, setAttribute) if (zend_hash_index_find(Z_ARRVAL_P(value), 1, (void**)&item) == SUCCESS) { if (Z_TYPE_PP(item) != IS_ARRAY) { pdo_raise_impl_error(dbh, NULL, "HY000", - "PDO_ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); " + "PDO::ATTR_STATEMENT_CLASS requires format array(classname, array(ctor_args)); " "ctor_args must be an array" TSRMLS_CC); PDO_HANDLE_DBH_ERR(); diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 7daa189dab..db2b45e769 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -1119,7 +1119,7 @@ static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, int mode, int fetch_all TSRMLS #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 1 if ((flags & PDO_FETCH_SERIALIZE) == PDO_FETCH_SERIALIZE) { - pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "PDO_FETCH_SERIALIZE is not supported in this PHP version" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "IM001", "PDO::FETCH_SERIALIZE is not supported in this PHP version" TSRMLS_CC); return 0; } #endif @@ -1127,18 +1127,18 @@ static int pdo_stmt_verify_mode(pdo_stmt_t *stmt, int mode, int fetch_all TSRMLS switch(mode) { case PDO_FETCH_FUNC: if (!fetch_all) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_FETCH_FUNC is only allowed in PDOStatement::fetchAll()" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_FUNC is only allowed in PDOStatement::fetchAll()" TSRMLS_CC); return 0; } return 1; default: if ((flags & PDO_FETCH_SERIALIZE) == PDO_FETCH_SERIALIZE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_FETCH_SERIALIZE can only be used together with PDO_FETCH_CLASS" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_SERIALIZE can only be used together with PDO::FETCH_CLASS" TSRMLS_CC); return 0; } if ((flags & PDO_FETCH_CLASSTYPE) == PDO_FETCH_CLASSTYPE) { - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_FETCH_CLASSTYPE can only be used together with PDO_FETCH_CLASS" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO::FETCH_CLASSTYPE can only be used together with PDO::FETCH_CLASS" TSRMLS_CC); return 0; } if (mode >= PDO_FETCH__MAX) { @@ -1366,7 +1366,7 @@ static PHP_METHOD(PDOStatement, fetchAll) stmt->fetch.column = Z_LVAL_P(arg2); break; case 3: - pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Third parameter not allowed for PDO_FETCH_COLUMN" TSRMLS_CC); + pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "Third parameter not allowed for PDO::FETCH_COLUMN" TSRMLS_CC); error = 1; } break; -- 2.40.0