Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Syntax error in i18n url function to add to AppHelper #13

Closed
ghost opened this Issue · 2 comments

2 participants

@ghost

This function to add to AppHelper doesn't work. It returns an synatx error:
"Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ')'"

    public function url($url = null, $full = false) {
        if (empty(is_array($url) && !array_key_exists('lang', $url)) {
            $url['lang'] = Configure::read('Config.language');
        }
        return parent::url($url, $full);
    }

The problem is the "&&" in the if clause...
For info, I'm using Cake 1.3.14 and PHP 5.3.8

@lorenzo lorenzo closed this in 2fe3e61
@ghost

When I use this version, it seems to work, the lang parameter is added, but I'm not sure it is the correct way...

    if (is_array($url) && !array_key_exists('lang', $url)) {
        $url['lang'] = Configure::read('Config.language');
    }
    return parent::url($url, $full);
@ghost

I'm sorry, but your correction doesn't work!

Fatal error: Can't use function return value in write context

the problem is the test "empty(is_array($url))"

@steinkel steinkel reopened this
@steinkel steinkel was assigned
@steinkel steinkel referenced this issue from a commit
Jorge González fixing #13 #14 fixing url function in readme file and adding default …
…language to Config.languages array
e6de0eb
@steinkel steinkel closed this
@steinkel steinkel was unassigned by ghost
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.