update_option() passing empty array() but still updating

I am reviewing some code in a custom plugin but I am not understanding how it could be working.

All form fields are indexed by name=opm_settings[name]

At the top of the page inside the function that draws the page is the following code:

    global $opm_settings;
    
    if ( array_key_exists('submit', $_POST) ) 
    {
        update_option('opm_settings', array());? 
            
    div id=setting-error-settings-updated class=settings_error notice notice-success is-dismissible
        p?php _e('Settings updated.', 'opm_domain'); ?/p
    /div
    
    ?php }

In the call to update_option() the 2nd parameter being passed is array() which is just an empty array ...

THe required value is:

(mixed) (Required) 
Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.

however, the actual data in the form is getting submitted and entered into the DB, not an empty array ... How? I don't understand.

Topic plugin-options plugin-development options Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.