Skip to content


Subversion checkout URL

You can clone with
Download ZIP


form_validation of arrays: what does CI when first array index != 0 #79

bitbucket-import opened this Issue · 1 comment

3 participants

@narfbg narfbg referenced this issue from a commit
@narfbg narfbg Fix issue #79 8d3099d
@narfbg narfbg closed this
@moura137 moura137 referenced this issue from a commit
@moura137 moura137 Merge branch 'develop' of git:// into …

* 'develop' of git:// (944 commits)
  Revert default config value of db pconnect to TRUE (issue #793)
  Updated pagination library documentation with prefix and suffix
  Fix issue #1533
  Fix issues #1529 & #1530
  Change where() to skip dbprefix (until a better solution is available)
  Fix Interbase _field_data() method
  Some fixes to the SQLSRV and MSSQL drivers
  Some changes to the OCI8 (Oracle) driver
  Use the VIEWPATH constant, instead of assuming the user hasn't moved them
  Add a default _limit() method to the Query Builder class
  Minor changes to the MySQL and MySQLi drivers
  Add _where() changes from pull #1517 to the PostgreSQL driver
  If there is no output then no need to try minifying it
  Added ['reuse_query_string'] to Pagination. This allows automatic repopulation of query string arguments, combined with normal URI segments.
  Clarified support of $config['csrf_exclude_uris'] support in v3.0 (#236)
  Added optional fourth parameter to timezone_menu
  fixed query grouping when using where($array) syntax
  Replaced block tag minification regex with a less greedy solution.
  Fix issue #79
  Fix issue #1510

@narfbg can this be ported to 2.1-stable?

I'm 2 hours stuck debugging this :(
I came up with a test case. As It is already written, i'll post it here.

class Test extends CI_Controller {

    public function __construct() {

    function index(){
        $_POST = array();
        echo $this->unit->report();

    function test_named_keys() {
        $_POST['sports']['nba']['basketball'] = 6; //from
        $_POST['sports']['nba']['another'] = 11;


        $this->form_validation_named->set_rules('sports[nba]', 'blabla', 'callback__valid_sports');

        $this->unit->run($this->form_validation_named->run(), FALSE, 'Form validation should fail - test_named_keys()');

    function test_keys(){
        $_POST['sports']['nba'][] = 6;
        $_POST['sports']['nba'][] = 11;

        $this->form_validation_->set_rules('sports[nba]', 'blabla', 'callback__valid_sports');

        $this->unit->run($this->form_validation_->run(), FALSE, 'Form validation should fail - test_keys()');

    function _valid_sports($arr) {
        foreach (debug_backtrace(false) as $call) {
            if ($call['class'] == 'Test' && $call['function'] != '_valid_sports') {
                echo '<br>Validating this with callback. Test: ',$call['function'],' Line:', $call['line'],'.';
                echo "<br>";
        return FALSE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.