ZF-5546: CLONE -CLONE -Zend_Db->query() silently dies after I try to insert text with length about 10 kilobytes. I'm using ZF 1.5.2 on Unix. I don't observe this problem on the same version on Windows
Description
by inserting an large text (greater than 5484 chars in ut8 charset, we uses "a's" as test character) into a database field Zend_Db_Statement causes an Apache segmentation fault the script dies in line 187 of Zend_Db_Statement without any exception to be caught
// remove 'foo\'bar'
$sql = preg_replace("/$q($qe|[^$q])*$q/", '', $sql);
We are using php 5.4.2 and apache 2.0 and apache 2.2 versions, and all versions are affected even if we use Zend Core php
Comments
Posted by Angelos Katsaris (akat) on 2009-01-14T06:49:19.000+0000
Hi,
I have the same problem, I have create a class to store html content at mysql. I can't store more than 5484 chars at utf-8 and i am getting back white screen with no errors. The only thing i can see is at the error log at apache (segmentation fault(11)). I am getting this error only at linux not on windows and i have test it on 3 linux servers with the same results.
I have try this at many php versions and nothing happen. Please Help!!!
a part of my class...
Posted by Ralph Schindler (ralph) on 2009-01-14T07:16:59.000+0000
Is that a 64 bit machine?
Also, you could try using the adapter insert method with placeholders, instead of crafting the query yourself:
This would then only quote the sql statement, and bind the parameters afterwards. Let me know if that helps.
Posted by Angelos Katsaris (akat) on 2009-01-14T07:49:24.000+0000
Thanks that solve my problem!!!
Posted by Angelos Katsaris (akat) on 2009-01-14T08:16:17.000+0000
Also if you want to avoid this way you can just execute the query like this.
$sql ="Insert into categories...."; $adapter->getConnection()->exec($sql);
Posted by Ralph Schindler (ralph) on 2009-01-14T08:30:09.000+0000
This is a known issue with preg_* functions on 64bit platforms. The workaround is to use the adapter with bound parameters instead of passing large unbound queries into the query() method.
And yes, by passing the adapter itself is definitely an option, but would result in decreasing the inherit benefits of using Zend_Db in the first place.
Thanks!