Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] \Request\File::getRealType() #1442

Closed
quasipickle opened this issue Oct 25, 2013 · 10 comments
Closed

[BUG] \Request\File::getRealType() #1442

quasipickle opened this issue Oct 25, 2013 · 10 comments

Comments

@quasipickle
Copy link
Contributor

This is a bug with the documentation that I believe is auto generated from the C-source (which is why I'm not posting this bug in the Docs repository).

Phalcon\Http\Request\File::getRealType() isn't implemented, but nowhere in the documentation does it say that. I had to look through C source code to find that comment.

phalcon pushed a commit that referenced this issue Oct 26, 2013
Fix #1442 implemented \Phalcon\Request\File::getRealType
@phalcon
Copy link
Collaborator

phalcon commented Oct 26, 2013

Implemented in 1.3.0

@phalcon phalcon closed this as completed Oct 26, 2013
@quasipickle
Copy link
Contributor Author

I just downloaded & installed 1.3.0 this morning and it's not working.

This is the code I'm running:

$File = $this->request->getUploadedFiles()[0];

$Finfo = new Finfo();
$finfo_mime = $Finfo->file($File->getTempName(),FILEINFO_MIME_TYPE);

var_dump($finfo_mime);
var_dump($File->getRealType());

And this is the output:

string(15) "application/pdf"
NULL

@dreamsxin
Copy link
Contributor

Can you test this:

phpunit unit-tests/RequestTest.php

@quasipickle
Copy link
Contributor Author

Seems fine - this is the output:

PHPUnit 3.7.25 by Sebastian Bergmann.

..

Time: 1.03 seconds, Memory: 2.50Mb

OK (2 tests, 36 assertions)

@dreamsxin
Copy link
Contributor

Can you in RequestTeset.php file find this code?

public function testIssues1442()

@quasipickle
Copy link
Contributor Author

I just re-downloaded the cphalcon-1.3.0.zip and the RequestTest.php file now has that function. Running it gives me this output:

PHPUnit 3.7.25 by Sebastian Bergmann.

.....F

Time: 226 ms, Memory: 2.50Mb

There was 1 failure:

1) RequestTest::testIssues1442
Failed asserting that 'image/jpeg' matches expected null.

/home/--my username--/cphalcon-1.3.0/unit-tests/RequestTest.php:349

@ghost
Copy link

ghost commented Oct 31, 2013

To clarify, did you build Phalcon from ext/?

@quasipickle
Copy link
Contributor Author

No, I built it from build/, as that's what the documentation says. Re-building it from ext/ makes the test run successfully.

@ghost
Copy link

ghost commented Oct 31, 2013

Please build development versions from ext/; build/ is for released versions.

For the development versions build/ and ext/ are often not synchronized (doing so would cause merge conflicts when there is more than one developer working on bug fixes / new features).

@quasipickle
Copy link
Contributor Author

Thanks - I'll remember to do that in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants