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

Warning: Invalid arguments supplied for memnstr() in \Phalcon\Tag::selectStatic($select_attributes, $options_list);

My tag select is throwing a warning:

Warning: Invalid arguments supplied for memnstr() in

I am calling it this way:

echo \Phalcon\Tag::selectStatic($select_attributes, $options_list);

Is this a known issue?



85.5k

can you print_r both arrays please ?



47.7k

$selectAttributes

Array ( 
[id] => my-select-box [onchange] => window.location.assign(this.options[this.selectedIndex].value,'_blank') 
[value] => /mysite/admin/invoices/invoicegroups
) 

$options_list

Array ( 
[/mysite/admin/invoices/invoicesgroups] => Invoice Groups 
[/mysite/admin/invoices/addinvoicesgroup] => Add Invoice Group 
[/mysite/admin/invoices/addinvoicesarticle] => Add Invoice Article 
[/mysite/admin/invoices/invoicesarticles] => Invoice Articles 
[/mysite/admin/invoices/addnewbespoke] => Add New Bespoke 
[/mysite/admin/invoices/listbespoke] => List Bespoke 
[/mysite/admin/invoices/settings] => Settings 
) 


85.5k
edited Sep '15

now that i am at home. first parameter should be string it gives the select name and id

bad documentation...

https://docs.phalcon.io/en/latest/reference/tags.html

search for selectStatic



47.7k
edited Sep '15

But usefull I will change the way I am building the values (after first array arg).

I beleive you were thinking of here:

<?php

// Using data from a resultset
echo $this->tag->select(
    array(
        "productId",
        Products::find("type = 'vegetables'"),
        "using" => array("id", "name")
    )
);

// Using data from an array
echo $this->tag->selectStatic(
    array(
        "status",
        array(
            "A" => "Active",
            "I" => "Inactive",
        )
    )
);

Api docs here:

What I have done is in the first argument used an array to define extra attributes in the <select> element.

The <select> element renders fine. It just comes up with this warning is all:

Warning: Invalid arguments supplied for memnstr() in

Would this constitute a bug?



85.5k

I would say its wrong documentation.

I suck at C so i cant find function definition



47.7k
edited Sep '15
I shouldn't be using a select with javascript as a nav anyway.

-S

I would say its wrong documentation.

I suck at C so i cant find function definition

I'd call it a bug. In Phalcon 1.3.x the function still accepted an array as the first parameter. I was generating a select with a bunch of data-attributes but after upgrading to 2.1.0 today, I had to change that code. Apparently the same bug was in the textField function but it was fixed there.