The CTools exporter, by default, adds a prefix of two spaces to the beginning of sub-variable that it exports. This works well for exporting arrays and such as it nicely formats the output. The problem, though, is that, when it exports multiline scalars (mainly strings), it unconditionally adds those two spaces to the beginning of each line in the multiline scalar. This is bad since it's altering the contents of the variable without consent. For us, it's mainly an annoyance right now, because each time we export a feature containing a Panel with PHP code or multiline CSS, every time we re-export it, it pushes the contents further to the right because of that unconditional indentation. The attached patch changes that behavior so that the prefix is only applied if the variable being exported is not a scalar.

Comments

mgriego’s picture

StatusFileSize
new711 bytes

So the patch I attached initially actually sucks. It only solves part of the problem. Scalars can still be modified if they're embedded in a nested array. The attached patch is much better as it solves the real problem instead of being a workaround.

mgriego’s picture

Status: Needs review » Reviewed & tested by the community

We have been using this in our environment for a while now, and it has definitely helped to make the module exports more VCS-friendly.

snufkin’s picture

I have also patched it here: #727772: Multiple line php variables are re-indented in consequtive exports, but i havent worked with scalars in arrays, so this solution is probably a better one.

mgriego’s picture

Thanks. I didn't see that when I went searching for this issue. My patch in #1 does fully fix the problem. Your patch is very close to my patch in the initial issue, which can still cause indentation to happen. I've added a note to that issue to reference this one.

snufkin’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
StatusFileSize
new1.03 KB

Rerolling for CVS version and fixing patch so patch -p0 actually works on it. Also fixed coding standard issues with concatenation.

This is a really annoying issue and this patch does fix it for me too.

sdboyer’s picture

Status: Reviewed & tested by the community » Fixed

We use the new standards on string concatenation (always have): http://drupal.org/coding-standards#concat - which means both of you got them wrong :P

Fixed & committed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.