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

Warning: escapeshellarg() expects parameter 1 to be string, array given (...) #45

Closed
YohannLYD opened this issue Jan 11, 2016 · 9 comments
Labels

Comments

@YohannLYD
Copy link

I am running into this error when I am trying to fetch information from a media.

ContextErrorException: Warning: escapeshellarg() expects parameter 1 to be string, array given in /Applications/MAMP/htdocs/playerAV/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessUtils.php line 74

Here is my controller action code :

public function testMediaAction(){

    $mediaInfo = new MediaInfo();
    $repository = $this->getDoctrine()
                       ->getManager()
                       ->getRepository('PlayerBundle:Player\Media');

    $media = $repository->findOneBy(array('id' => '5'));
    $fichier = $media->getWebPath();

    $general = $mediaInfo->getInfo($fichier)->getGeneral();
    return $this->render('PlayerBundle:Player:Media/test.html.twig', array('general' => $general));
}

I can't find the part where I am doing something wrong. Any idea where the issue comes from ?
I am using Symfony 2.3, MediaInfo v0.7.77 (installed on Mac OS X via homebrew) and running my server locally with MAMP.

@mhor mhor added the bug label Jan 11, 2016
@mhor
Copy link
Owner

mhor commented Jan 11, 2016

Thanks for issue reporting @YohannLYD.

What is the value of $fichier?

@YohannLYD
Copy link
Author

The value of $fichier returns the path to the media file ("uploads/film.mp4" in my case).

mhor added a commit that referenced this issue Jan 13, 2016
mhor added a commit that referenced this issue Jan 13, 2016
@mhor
Copy link
Owner

mhor commented Jan 13, 2016

@YohannLYD Could you tell me if #46 fix the bug

@YohannLYD
Copy link
Author

@mhor unfortunaltely it doesn't, I run into a "sh: mediainfo: command not found" error when I make the changes to MediaInfoCommandRunner.php

@mhor
Copy link
Owner

mhor commented Jan 14, 2016

@YohannLYD mediainfo command doesn't exist, it's probably not the right command to run mediainfo. Wich command did you use to run mediainfo on cli?

@YohannLYD
Copy link
Author

Hi @mhor,

On the cli, both "mediainfo" and "/usr/local/bin/mediainfo" can run the command.
I made a slight change on MediaInfoCommandRunner.php which made the bundle work.
If I change the line

protected $command = 'mediainfo';

by the absolute path of the binary (/usr/local/bin/mediainfo in my case)

protected $command = '/usr/local/bin/mediainfo';

I can properly get the information of my media.

It's kind of good for me this way, but I am not sure about how to make the bundle work just by providing "mediainfo" instead its full path.

mhor added a commit that referenced this issue Jan 18, 2016
@mhor
Copy link
Owner

mhor commented Jan 18, 2016

@YohannLYD IMO the $command property should be configurable like:

$mediaInfo = new MediaInfo();
$mediaInfo->setConfig('command', '/usr/local/bin/mediainfo');
$mediaInfoContainer = $mediaInfo->getInfo('music.mp3');

see #47

@YohannLYD
Copy link
Author

@mhor it works now. I ran into another error but you can see #47 for my suggestions.

@mhor
Copy link
Owner

mhor commented Jan 19, 2016

Ok @YohannLYD I close this issue

@mhor mhor closed this as completed Jan 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants