mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DBALException bin2hex() expects parameter 1 to be string, resource given #5796
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @holantomas on GitHub (Dec 5, 2017).
Originally assigned to: @Ocramius on GitHub.
Hi,
I have entity
FileContentwith few properitiesid,bytes.bytesisblob. When I'm saving file stream from upload to DB it try to throw exeption bellow but it fall on param formating when it try to call bin2hex on stream resource (uploaded file).Trying to throw exception
SQLSTATE[08S01]: Communication link failure: 1153 Got a packet bigger than 'max_allowed_packet' bytes"Don't know what else to report, so you can ask what you need.
And yes I know how to solve first exception.
@Ocramius commented on GitHub (Dec 5, 2017):
Could you maybe add a test case that reproduces the issue, so we can prevent regressions on a fix?
@holantomas commented on GitHub (Dec 5, 2017):
Error is depend on your mysql settings of
max_allowed_packet. By default it's set to 16M. I tried to upload PHP stream resource with 20MB file.Database definition ofr example.
This throws what I'm talking about. Sorry don't know if you need something better.
tmpfile()is usage just for create stream resource which cause app fall@Ocramius commented on GitHub (Dec 5, 2017):
Right, and a test case would:
str_repeat('a', $db->select('SELECT setting FROM settings_table')->fetchColumn(0) * 1024 * 1024);php://temp)Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/
On Tue, Dec 5, 2017 at 9:07 AM, Tomáš Holan notifications@github.com
wrote:
@holantomas commented on GitHub (Dec 5, 2017):
I really don't know what you want. So I found that this issue is DBAL problem so I will close this after your answer and recreate it in right repository. But for clean I did test case commit to Doctrine/DBAL. Is'nt that better?
9f1c15815b@holantomas commented on GitHub (Dec 5, 2017):
I'm ready to make PR for this commit.
Or better this can be fixed by editing
Doctrine\DBAL\DBALException::formatParameters()to something like this:@Ocramius commented on GitHub (Dec 5, 2017):
@holantomas that test looks good, but indeed it is on the DBAL project. Open a PR and we'll close this one :-)
@holantomas commented on GitHub (Dec 5, 2017):
https://github.com/doctrine/dbal/pull/2933