Development

#1451 (Inconsistent line endings in generated crud modules)

You must first sign up to be able to contribute.

Ticket #1451 (closed defect: wontfix)

Opened 3 years ago

Last modified 2 months ago

Inconsistent line endings in generated crud modules

Reported by: JanBlaha Assigned to: fabien
Priority: minor Milestone:
Component: generator Version: 1.0.11
Keywords: eol line end inconsistency Cc:
Qualification: Unreviewed

Description

In generated crud files and admin initiated cache files exists line endings inconsistency.

Those files should generally have eol style of template files and native to operating system.

In sfGenerator class there is a piece of code with hardcoded line feeds (\n), that prepends the template with a header:

protected function evalTemplate($templateFile)
  {
    $templateFile = sfLoader::getGeneratorTemplate($this->getGeneratorClass(), $this->getTheme(), $templateFile);

    // eval template file
    ob_start();
    require($templateFile);
    $content = ob_get_clean();

    // replace [?php and ?]
    $content = $this->replacePhpMarks($content);

    $retval = "<?php\n".
              "// auto-generated by ".$this->getGeneratorClass()."\n".
              "// date: %s\n?>\n%s";
    $retval = sprintf($retval, date('Y/m/d H:i:s'), $content);

    return $retval;
  }

If the template file has not unix eol style, the result is line endings inconsistency.

Change History

02/14/07 15:47:12 changed by JanBlaha

I ran across another issue with end of lines. This time it concerns models built by symfony propel-build-model command and is caused by incorrect setting of svn:eol-style property in symfony SVN repository:

PHP5BasicObjectBuilder.php does not have svn:eol-style property set,

SfObjectBuilder.php has svn:eol-style property set to native.

Both classes build the same file. Result is line endings inconsistency once again.

02/15/07 13:05:53 changed by JanBlaha

Yet another inconsistency exists in generated crud views. sfCrudGenerator class is responsible this time, namely its method getObjectTagParams() that relies on var_export. var_export as far as I can recognize generates line feeds only.

02/26/08 05:23:40 changed by Carl.Vondrick

  • owner set to fabien.
  • version changed from 1.0.0-rc1 to 1.0.11.
  • component set to generator.
  • qualification set to Unreviewed.

01/27/10 15:13:09 changed by FabianLange

  • status changed from new to closed.
  • resolution set to wontfix.

The sf1.0 branch is no longer maintained by the core team.

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.