0

My coworker and I are baffled by a recent issue that came up when we switched all of our embeds over to Low Variables. The weirdest part is that the issue is happening on his machine, not mine, and we have identical code and database...

So, we have a low variable we called 'low_snippet_left_sidebar' that's set for early parsing, and saved as a file. We're calling it from our template by using just {low_snippet_left_sidebar}.

{exp:navee:custom
    nav_title="main-nav"
    start_nav_from_parent="true"
    class="secondary-nav"
    only_display_children_of_selected="true"
    selected_class_on_parents="true"
    parent_selected_class="parent-selected"
    }
    <li class="{class}" data-count="{navee_count}"><a href="{link}" rel="{rel}" target="{target}" title="{title}"><span>{text}</span></a>{kids}</li>
{/exp:navee:custom}

And when that renders on the page, it spits out the nav just fine... except before each nav item, there's a stray d" } that shows up for some reason... And that just happens to be the end of that long navee tag with parameters on separate lines.

I tested out swapping the last two parameters in that tag, and what ended up happening was the stray characters became e" } instead. Weird.

So then we tried making that navee tag all on one line, without having each parameter on its own line, and the problem went away! What is happening here?

How come having line breaks in my tags works on my machine, but not on my co-workers? This issue doesn't arise if we just use EE's Snippets instead of Low Variables...

here is a pic of the nav that gets output, without the errors (we used EE snippet) http://paleosun.com/misc/mahec-secondary-nav-working.png

And here's a pic of the nav that gets output as a Low Variable http://paleosun.com/misc/mahec-secondary-nav-broken.png

Any ideas/hints/clues? I don't think this is a nav-ee related issue, as the same issue is happening wherever we have line-breaks between parameters in tags, in a low variable, and only on my coworkers computer...

Thanks!

  • I did see a similar support request once. Logic dictates that there must be an environmental difference between you and your co-workers. Just to be complete, what are your PHP, EE and LV versions? What OS are you running? Also, can you check what the DB collation/charset is of the LV database table? I reckon it might have something to do with how newlines are treated somehow... – Low Jun 4 '13 at 8:15
  • Hmm. Nope, we are running the exact same codebase and database, EE 2.5.5. That's why it's really strange to me. It works just fine on my local XAMPP setup, as well as on a dev server. And my colleague has the exact same laptop as me. However, he does have slightly newer PHP and Apache versions installed. So, it works on my machine and doesn't on his. Here are the differences I can identify, by doing a diff of our phpinfo output: – Gary Reckard Jun 4 '13 at 17:00
  • My setup: PHP Version 5.3.8 PHP API 20090626 PHP Extension 20090626 Zend Extension 220090626 Zend Multibyte Support disabled Zend Engine v2.3.0 Apache Version Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 His setup: PHP Version 5.4.4 PHP API 20100412 PHP Extension 20100525 Zend Extension 220100525 Zend Multibyte Support provided by mbstring Zend Engine v2.4.0 Apache Version Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4 – Gary Reckard Jun 4 '13 at 17:01
  • In both of our databases, the collation is 'latin1_swedish_ci' on the low_variables tables, but 'utf8_general_ci' for all others... And we're both on Windows 7, Low Variables 2.3.1, EE 2.5.5 – Gary Reckard Jun 4 '13 at 17:01
  • Can you try this: open up base.low_variables.php, look up line #355, and then change array('variable_data' => read_file($file)), to array('variable_data' => str_replace("\r\n", "\n", read_file($file))), and see if that helps? – Low Jun 5 '13 at 7:57
1

So, after following a hunch, this is indeed due to the way new lines/carriage returns are handled on some Windows environments.

To fix, open up base.low_variables.php, look up the line that says:

array('variable_data' => read_file($file)),

And change that to:

array('variable_data' => str_replace("\r\n", "\n", read_file($file))),

In LV v2.3.1, that's line 355. In the latest version (v2.3.5), it's line 342.

| improve this answer | |
0

There is an acknowledged bug with EE 2.6.1 where multi-line parameters in templates are broken. I'd guess that you are running different EE versions locally?

| improve this answer | |
  • Hmm. Nope, we are running the exact same codebase and database, EE 2.5.5. That's why it's really strange to me. It works just fine on my local XAMPP setup, as well as on a dev server. And my colleague has the exact same laptop as me. However, he does have slightly newer PHP and Apache versions installed. So, it works on my machine and doesn't on his. Here are the differences I can identify: PHP version: Mine: 5.3.8 – Gary Reckard Jun 4 '13 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.