array('x'), 'limit' => array('y'), )); check('array offset/limit records no PHP notice or warning', count($php_errors) === 0); check('array offset falls back to 0', $offset == 0); check('array limit falls back to 100', $limit == 100); check('array offset/limit logs exactly two errors', count($errors) === 2); $has_array = false; foreach ($errors as $e) { if (strpos($e, 'Array') !== false) $has_array = true; } check('array error messages do not contain "Array"', !$has_array); list($offset, $limit, $errors, $php_errors) = run_case($block, array( 'offset' => '5', 'limit' => '20', )); check('numeric strings are accepted as offset and limit', $offset === 5 and $limit === 20); check('valid offset/limit logs no errors', count($errors) === 0); list($offset, $limit, $errors, $php_errors) = run_case($block, array( 'offset' => 'abc', 'limit' => '-1', )); check('non-numeric offset falls back to 0', $offset == 0); check('negative limit falls back to 100', $limit == 100); check('invalid offset/limit logs exactly two errors', count($errors) === 2); echo $failures ? "\n$failures failed\n" : "\nall passed\n"; exit($failures ? 1 : 0); }