Bug #75671 [NEW]: pg_version() crashes when called on a connection to cockroach
| From: | magicaltux at gmail dot com | Date: | Tue, 12 Dec 2017 09:53:05 +0000 |
| Subject: | Bug #75671 [NEW]: pg_version() crashes when called on a connection to cockroach | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213067@lists.php.net to get a copy of this message | ||
From: magicaltux at gmail dot com
Operating system: Linux Ubuntu 16 LTS
PHP version: 7.2.0
Package: PostgreSQL related
Bug Type: Bug
Bug description:pg_version() crashes when called on a connection to cockroach
Description:
------------
Cockroach server offers a pgsql compatible wire protocol, and supports a
large subset of pgsql:
https://www.cockroachlabs.com/docs/stable/sql-feature-support.html
Calling pg_version() on a cockroach pgsql connection will however result
in a segfault. Even if the server doesn't support part of the protocol,
php shouldn't segfault because of that.
Test script:
---------------
$pg = pg_connect("...");
var_dump(pg_version($pg));
Expected result:
----------------
(pg_version() output)
Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106 ../sysdeps/x86_64/strlen.S: No such file or directory.
(gdb) bt
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x00000000008f69c2 in add_assoc_string_ex
(arg=arg@entry=0x7fffed21d0a0, key=key@entry=0x107dbef
"server_encoding", key_len=key_len@entry=15, str=0x0)
at /usr/src/php-web-7.2.0/Zend/zend_API.c:1414
#2 0x00000000006fa2a8 in php_pgsql_get_link_info
(return_value=0x7fffed21d0a0, entry_type=<optimized out>,
execute_data=<optimized out>) at
/usr/src/php-web-7.2.0/ext/pgsql/pgsql.c:1649
#3 0x000000000099f426 in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER () at
/usr/src/php-web-7.2.0/Zend/zend_vm_execute.h:617
#4 execute_ex (ex=0x0) at
/usr/src/php-web-7.2.0/Zend/zend_vm_execute.h:59737
#5 0x00000000009a4f1e in zend_execute (op_array=0x7fffed27c2a0,
op_array@entry=0x7fffdfedb320, return_value=0x0,
return_value@entry=0x7fffed21d030)
at /usr/src/php-web-7.2.0/Zend/zend_vm_execute.h:63763
#6 0x00000000008f3a13 in zend_execute_scripts (type=type@entry=8,
retval=0x7fffed21d030, retval@entry=0x0, file_count=file_count@entry=3)
at /usr/src/php-web-7.2.0/Zend/zend.c:1496
#7 0x000000000088f040 in php_execute_script
(primary_file=primary_file@entry=0x7fffffffd240) at
/usr/src/php-web-7.2.0/main/main.c:2592
#8 0x00000000009a72e9 in do_cli (argc=2, argv=0x14c9060) at
/usr/src/php-web-7.2.0/sapi/cli/php_cli.c:1011
#9 0x000000000044ea5c in main (argc=2, argv=0x14c9060) at
/usr/src/php-web-7.2.0/sapi/cli/php_cli.c:1404
--
Edit bug report at https://bugs.php.net/bug.php?id=75671&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75671&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75671&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75671&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75671&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75671&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75671&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75671&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75671&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75671&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75671&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75671&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75671&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75671&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75671&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75671&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75671&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75671&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75671&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75671&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75671&r=mysqlcfg