php中的OutOfRangeException [关闭]

I get this error

[OutOfRangeException] Offset out of range

Though I have used

set_error_handler(array($this, 'handleError'));

in constructor. But the code flow never comes to handleError method and program exits after the error.

PHP's set_error_handler sets a handler for Errors, not Exceptions.

In user code, errors can be triggered with trigger_error, while exception can be thrown with throw. The standard library uses a mix of these techniques.

The code you are using is throwing an exception, to stop that ending your program, you need to wrap it in a try..catch construct.