anbu icon indicating copy to clipboard operation
anbu copied to clipboard

Serialization of UploadedFile is not allowed

Open dimsav opened this issue 11 years ago • 7 comments

Hi and thanks for this nice profiler.

After uploading a file I get the exception below. I am not sure if I should just exclude anbu for this request or if this is a bug.

{"error":{"type":"Exception","message":"Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed","file":"/home/vagrant/.../vendor/daylerees/anbu/src/Profiler.php","line":234}}

Thanks!

dimsav avatar Sep 15 '14 07:09 dimsav

Can you explain a bit about how to recreate the error? Which file, what does your route do, and the corresponding controller@method?

On Mon, Sep 15, 2014 at 9:26 AM, Dimitrios Savvopoulos [email protected] wrote:

Hi and thanks for this nice profiler. After uploading a file I get the exception below. I am not sure if I should just exclude anbu for this request or if this is a bug. {"error":{"type":"Exception","message":"Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed","file":"/home/vagrant/.../vendor/daylerees/anbu/src/Profiler.php","line":234}}

Thanks!

Reply to this email directly or view it on GitHub: https://github.com/daylerees/anbu/issues/14

jstoone avatar Sep 15 '14 07:09 jstoone

I am sending an ajax post request with the file (the type of the file is unimportant) using blueimp/jQuery-File-Upload for the JavaScript part.

To make sure my code doesn't produce the problem, I replaced my controller action with return 1; and nothing changed.

The exception is thrown before the controller code is executed. I did a var_dump of $this->fetchStorage() before it is serialized and this is what I found:

[cover] => Symfony\Component\HttpFoundation\File\UploadedFile Object
(
    [test:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 
    [originalName:Symfony\Component\HttpFoundation\File\UploadedFile:private] => welcome.jpg
    [mimeType:Symfony\Component\HttpFoundation\File\UploadedFile:private] => image/jpeg
    [size:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 17964
    [error:Symfony\Component\HttpFoundation\File\UploadedFile:private] => 0
    [pathName:SplFileInfo:private] => /tmp/phpu1mHRY
    [fileName:SplFileInfo:private] => phpu1mHRY
)

dimsav avatar Sep 15 '14 08:09 dimsav

Maybe @daylerees has something in mind, a module maybe, about profiling uploaded files.

dimsav avatar Sep 15 '14 08:09 dimsav

Ah this is a bug in the request module. I'll have to do some presenting of files before storing the data array.

daylerees avatar Sep 15 '14 10:09 daylerees

Just came upon this bug myself. Had to disable Anbu while using file uploads.

swvjeff avatar Nov 05 '14 05:11 swvjeff

Sorry guys, I'll be getting back to Anbu soon. Trying to split time across side projects. It's an easy fix :)

daylerees avatar Nov 05 '14 14:11 daylerees

No worries! Thanks for making such an awesome tool :)

swvjeff avatar Nov 06 '14 10:11 swvjeff