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

Better error message when system and/or exec functions are disabled #168

Open
thiagoalessio opened this issue Aug 13, 2019 · 1 comment
Open
Assignees

Comments

@thiagoalessio
Copy link
Owner

Expected behavior

Present a clear error message to users if environment has disabled system and/or exec builtin PHP functions, and interrupt the execution before attempting to use such disabled functions.

Actual behavior

Right now nothing stops the execution, and it fails much later with a "Command did not produce any output" exception.
Only warnings are shown:

<b>Warning</b>:  system() has been disabled for security reasons in ...
<b>Warning</b>:  exec() has been disabled for security reasons in ...

Steps to reproduce the behavior

  1. Disable system and/or exec in php.ini
    https://www.php.net/manual/en/ini.core.php#ini.disable-functions
  2. Try to run any TesseractOCR example.

Environment

  • Operating system: any
  • PHP version: any
  • Tesseract version: any
  • tesseract-ocr-for-php version: 2.7.4 or lower
@thiagoalessio thiagoalessio self-assigned this Aug 13, 2019
thiagoalessio added a commit that referenced this issue Aug 13, 2019
This library relies on `system` and `exec`. Solves issue #168
@ThomasLandauer
Copy link

Maybe you could also add some nice method to check if tesseract is installed at all. When (mis)using $ocr->version() for this, I'm getting 1: if it's not installed - probably some artifact of the exploding that's done at Command::getTesseractVersion()

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

No branches or pull requests

2 participants