Fix getAndLock test to match corrected function signature.
PCBC-310: Corrected segmentation faults when performing operations.

Additionally refactored source code to better
code maintainability, along with changes to PHP
script including for easier debugging of PHP code.
Release 2.0.2.