Skip to content

Values passed into variable_get() that are strings creating unnecessary "dynamic" warnings #56

@rbargerhuff

Description

@rbargerhuff

Hello,

We noticed while using coder_upgrade that values passed into variable_get() that contains special characters were being wrapped with single quotes which was ending up as a syntax error due to incorrect conversion. For example:

return variable_get('cas_server_whitelist_failure', t('You do not have permission to login to CAS from this service.'));

While troubleshooting the reason for this, we noticed 2 issues in conversions/call.inc:

First Issue: The variable $raw_value was not being referenced in the preg_match() call which prevented the dynamic warning from being written to the patch file:

// elseif (preg_match('@[\.\s\$\[\]\#\>\(]@', $value)) {
elseif (preg_match('@[\.\s\$\[\]\#\>\(]@', $raw_value)) {

Once this was fixed, we noticed that string values that contained a "space" were triggering the dynamic warning so we updated the elseif to account for this:

elseif (!preg_match('@^\'[^\']*\'$@', $raw_value) && preg_match('@[\.\s\$\[\]\#\>\(]@', $raw_value)) {

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions