mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
removing line ending code from File::write(), adding it to bake, fixes #3460
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5897 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
9b57b59c28
commit
c68aedb9c4
2 changed files with 7 additions and 5 deletions
|
@ -433,6 +433,13 @@ class Shell extends Object {
|
||||||
if (!class_exists('File')) {
|
if (!class_exists('File')) {
|
||||||
uses('file');
|
uses('file');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$lineBreak = "\n";
|
||||||
|
if (substr(PHP_OS,0,3) == "WIN") {
|
||||||
|
$lineBreak = "\r\n";
|
||||||
|
}
|
||||||
|
$data = strtr($contents, array("\r\n" => $lineBreak, "\n" => $lineBreak, "\r" => $lineBreak));
|
||||||
|
|
||||||
if ($File = new File($path, true)) {
|
if ($File = new File($path, true)) {
|
||||||
$File->write($contents);
|
$File->write($contents);
|
||||||
$this->out(__("Wrote", true) ." {$path}");
|
$this->out(__("Wrote", true) ." {$path}");
|
||||||
|
|
|
@ -216,11 +216,6 @@ class File extends Object {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$lineBreak = "\n";
|
|
||||||
if (substr(PHP_OS,0,3) == "WIN") {
|
|
||||||
$lineBreak = "\r\n";
|
|
||||||
}
|
|
||||||
$data = strtr($data, array("\r\n" => $lineBreak, "\n" => $lineBreak, "\r" => $lineBreak));
|
|
||||||
|
|
||||||
if (fwrite($this->handle, $data) !== false) {
|
if (fwrite($this->handle, $data) !== false) {
|
||||||
$success = true;
|
$success = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue