You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears the PDO_DBLIB driver I am using for my PHP PDO connection is overwriting custom check constraint messages. When I bypass the driver and run the same queries this is what I get:
1>> insert into Local_contact (loc_contact, group_id, lc_name, updated)
2>> values ('****', 1, 'test', getDate())
3>> go
Msg 30078, Level 16, State 1:
Server 'ZING', Line 1:
Local Contact contains illegal characters
Command has been aborted.
1>> delete from Depot where depot = 'AARA'
2>> go
Msg 547, Level 16, State 1:
Server 'ZING', Procedure 'Depot_del_trig', Line 3:
Dependent foreign key constraint violation in a referential integrity constraint. dbname = 'caiprod', table name = 'Location', constraint name = 'History_location_fkey'.
Command has been aborted.
The first query, insert into Local_contact, returns this error "SQLSTATE[HY000]: General error: 20018 Command has been aborted.\n [20018] (severity 16) [insert into Local_contact ...". I was expecting the custom check constraint message "Local Contact contains illegal characters", but it returned "Command has been aborted."
The second query, delete from Depot, returns "Dependent foreign key constraint violation in a referential integrity constraint. dbname = 'caiprod', table name = 'Location', constraint name = 'History_location_fkey'.\n [20018] (severity 16) [delete from Depot ...". This is the correct error message that I was expecting.
I patched it in my own repo but wanted to report the issue and PR my fix.
Best,
Carey Nelms
PHP Version
PHP 8.4.27 (cli) (built: Nov 5 2026 07:23:55) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.4.27, Copyright (c) Zend Technologies
with Zend OPcache v8.4.27, Copyright (c), by Zend Technologies
Operating System
Debian GNU/Linux 13 (trixie)
Database
Adaptive Server Enterprise/16.0 SP04 GA/EBF 29650 SMP/P/x86_64/SLES 12.4/asecorona/3202/64-bit/FBO/Wed Nov 18 09:12:58 2020
I attempted to PR a patch to the 8.4 branch but received a permission denied message:
Pushing to github.com:php/php-src.git
ERROR: Permission to php/php-src.git denied to cnelms.
So I will send diffs and code for the patch. It involves two files.
ext/pdo_dblib/pdo_dblib.c
int pdo_dblib_msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
int severity, char *msgtext, char *srvname, char *procname, int line)
{
pdo_dblib_err *einfo;
if (severity >= 11 && msgtext != NULL && *msgtext != '\0') {
einfo = (pdo_dblib_err*)dbgetuserdata(dbproc);
if (!einfo) {
einfo = &DBLIB_G(err);
}
/*
* Preserve the first actual server error.
* Ignore subsequent messages, including severity 10
* "Command has been aborted."
*/
if (einfo->lastmsg == NULL) {
einfo->lastmsg = estrdup(msgtext);
}
}
return 0;
}
Activity
cnelms commentedon Nov 14, 2026
I attempted to PR a patch to the 8.4 branch but received a permission denied message:
Pushing to github.com:php/php-src.git
ERROR: Permission to php/php-src.git denied to cnelms.
So I will send diffs and code for the patch. It involves two files.