Skip to content

Updated for windows and bash#5

Open
RickKukiela wants to merge 15 commits into
johnzuk:masterfrom
BelniakMedia:master
Open

Updated for windows and bash#5
RickKukiela wants to merge 15 commits into
johnzuk:masterfrom
BelniakMedia:master

Conversation

@RickKukiela
Copy link
Copy Markdown

This fork changes the shell commands with windows and bash style shells. This will no longer work on the system the original author wrote it on. I'm not sure what type of shell they were using but the manner in which they were setting the environment variable does not work on windows or centos/bash. This fork addresses that problem by using the windows "set" command via powershell which supports piping. The command for non windows machines was changed to use "export" for setting the environment.

An additional change was made to the parsing of the return value as the PHP_EOL value used in the original source was not working on my machine. This was changed to "\n" and it works great.

Rick Kukiela added 3 commits August 2, 2018 01:02
…ws and standard bash shell. Changed a split character in parsing method.
Comment thread src/HunspellPHP/Hunspell.php Outdated
unset($result[0]);
$words = array_map('trim', explode(" ", $words));
$result = explode("\n", trim($input));
array_shift($result);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to mention in the notes that I also changed the split char from " " to a regex \W because when people search for things on my site like blue/black it chokes up. I also added a catch in case something else breaks a warning is not thown if vars of two sizes are going to be passed to array_combine.

Added
- Added PHP8.0 typed class,
- Added constructor to main `HunspellPHP` class where the `$dictionary`, `$encoding` and `$dictionary_path` cal be set/overridden during initialization.
- Added `$dictionary_path` as a new argument were the dictionary files path may be specified (system default search locations are used otherwise). Additional `get()` and `set()`methods added.
- Added functionality to `findCommand` method via new `(bool)$stem_mode` argument.

Removed
- Removed `findStemCommand` method.
- Removed unused exception classes.
- Removed `HunspellPHP\Exceptions` namespace.
- Removed composer.lock from repo.

Fixed
- Renamed `$language` more appropriately `$dictionary` since that is what that property is referencing.
- Moved HunspellMatchTypeException up one directory to \HunspellPHP namespace.
- Fixed an issue where not all `$match` values were returned from the command response resulting in PHP warnings.
- Fixed a missing type `-` extraction from the matcher regex which resulted in PHP warnings and bad responses.
…a path to a custom word list to be merged with the dictionary at runtime.

- Windows/Linux environments now use the same process execution code.
- Hunspell process invocation is now handled through `proc_open` instead of `shell_exec`.
- Hunspell `stderr` output is now logged via `error_log()` call.
#### Changed
- Changed constructor argument `$encoding` default value from 'en_US.utf-8' to 'UTF-8'.
… property for caching to ensure the call is not made more than once per instance.

- Refactored `hunspellSuggest()` to work with space-separated list of words and return parsed result batch - This avoids needing to invoke the proc for each word which was a major performance issue.
…he stem branch of this library works correctly after the batch improvement made in the previous commit.
- Bumped version in composer.json to 4.0.0.
…arameter when instantiating `HunspellResponse` objects.

- Updated readme/changelog and bumped version to 4.0.1
…he offest param to `HunspellResponse::__construct()`.

- Updated changelog and bumped version to 4.0.2
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

Successfully merging this pull request may close these issues.

1 participant