We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[CLOSED] Filter sanitize

Hi! From last update my Controller's filtering starts working wrong:

// somewhere in controller
$news_id = $this->filter->sanitize($news_id, "int");

returns 'string', not 'integer'



51.2k

Sanitize is removing any non digits from string. By default, in PHP, all user input data is cast as string. You can force to a specific type: (int)$news_is. See. https://us3.php.net/manual/en/language.types.type-juggling.php

// returns "100019"
$filter->sanitize("!100a019", "int");

Sorry, I'm jumped from ZendFramework. Expected by me full filtering to integer value. Post closed.