daylerees / anbu

Anbu profiler for the Laravel PHP Framework.
309 stars 24 forks source link

Serialization of UploadedFile is not allowed #14

Open dimsav opened 10 years ago

dimsav commented 10 years ago

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!

jstoone commented 10 years ago

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 notifications@github.com 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

dimsav commented 10 years ago

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 commented 10 years ago

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

daylerees commented 10 years ago

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

swvjeff commented 10 years ago

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

daylerees commented 10 years ago

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

swvjeff commented 10 years ago

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