|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-09-15 13:04 UTC] [email protected]
-Summary: Memory corruption in bindParam / utf8
+Summary: Memory corruption in bindParam
[2016-09-15 13:04 UTC] [email protected]
[2016-09-15 15:40 UTC] dorin dot marcoci at gmail dot com
[2016-09-16 17:23 UTC] [email protected]
[2016-11-06 16:15 UTC] [email protected]
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: ab
[2016-11-06 16:15 UTC] [email protected]
[2017-02-04 19:31 UTC] riosjp885 at gmail dot com
[2017-02-04 20:08 UTC] dorin dot marcoci at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Mar 17 12:00:01 2026 UTC |
Description: ------------ This bug is always reproductive by running script below. PHP crashes with SIGSEGV and Nginx returns "Bad Gateway". The problem seems to be in assigning UTF8 encoded string to BLOB param. Crash happens on second statement, while fetchAll. ENVIRONEMENT: Debian 8.5 Firebird 2.5.4 PHP-fpm 7.0.10 Nginx 1.6.2 TABLE DDL: SET SQL DIALECT 3; CREATE TABLE TA_TEST ( ID DS_ID NOT NULL /* DS_ID = BIGINT */, NAME DT_CHAR50U NOT NULL /* DT_CHAR50U = VARCHAR(50) */, CONTENT DT_TEXTU NOT NULL /* DT_TEXTU = BLOB SUB_TYPE 1 SEGMENT SIZE 100 */ ); ALTER TABLE TA_TEST ADD CONSTRAINT PK_TA_TEST PRIMARY KEY (ID); Test script: --------------- <?php $C = [ 'kind' => 'firebird', 'host' => 'localhost', 'port' => 3050, 'base' => 'testbase', 'charset' => 'utf8', 'user' => 'SYSDBA', 'password' => 'masterkey', 'options' => [ PDO::ATTR_PERSISTENT => TRUE, PDO::ATTR_CASE => PDO::CASE_LOWER, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ] ]; $S = $C['kind'].':host='.$C['host'].';port='.$C['port'].';dbname='.$C['base'].';charset='.$C['charset']; $D = new PDO($S, $C['user'], $C['password'], $C['options']); $Q = $D->prepare('insert into ta_test (id, name, content) values (next value for gs_id, :name, :content)'); for ($I = 0; $I < 100; $I++) { $Params = [ 'name' => utf8_encode(bin2hex(random_bytes(20))), 'content' => utf8_encode(bin2hex(random_bytes(20))) ]; foreach ($Params as $Param => $Value) $Q->bindValue($Param, $Value); $Q->execute(); $R = $Q->fetch(); echo 'I:'.$I; print_r($R); } $E = $D->prepare('select first 100 id, name, content from ta_test'); $E->execute(); $T = $E->fetchAll(); print_r($T); echo 'OK!'; Expected result: ---------------- Run without crashes Actual result: -------------- SIGSEGV, Memory corruption. Please solve this annoying bug, it's a stopper for us.