Fix PHP flaw around intval with custom base.

This seems to be a pretty ugly flaw in PHP itself, documented in the PHP docs:

> Note:
The base parameter has no effect unless the var parameter is a string.

```php
echo intval(42, 8);                   // 42
echo intval('42', 8);                 // 34
```

Thus this cast should be necessary, as the expected input in $mode is of type `int`.