aktualizacja symfony 1.4 do PHP 7.3

Notatnik programisty zawsze pod ręką!

aktualizacja symfony 1.4 do PHP 7.3

In %SF_LIB_DIR%/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Collection.php line 463 you will find:

$record->$relation['alias'] = $this->reference;

In PHP 5 this was interpreted as

$record->${relation['alias']} = $this->reference;

what the author intended. In PHP7 it will be interpreted as

${record->$relation}['alias'] = $this->reference;

what leads to the error regarding relations.

To remedy this problem, just make the implicit explicit:

$record->{$relation['alias']} = $this->reference;

and this problem is gone.

Additionally you have to change in following Doctrine files: Doctrine/Adapter/Oracle.php line 586 from

$query = preg_replace("/(\?)/e", '":oci_b_var_". $bind_index++' , $query);

to

$query = preg_replace_callback("/(\?)/", function () use (&$bind_index) { return ":oci_b_var_".$bind_index++; }, $query);

Doctrine/Connection/Mssql.php line 264 from

$tokens[$i] = trim(preg_replace('/##(\d+)##/e', "\$chunks[\\1]", $tokens[$i]));

to

$tokens[$i] = trim(preg_replace_callback('/##(\d+)##/',function ($m) use($chunks) { return $chunks[(int) $m[1]]; }, $tokens[$i] ));

and line 415 from

$query = preg_replace('/##(\d+)##/e', $replacement, $query);

to

$query = preg_replace_callback('/##(\d+)##/', function($m) use ($value) { return is_null($value) ? 'NULL' : $this->quote($params[(int) $m[1]]); }, $query);

and replace normalizeHeaderName

/lib/vendor/symfony/lib/response/sfWebResponse.class.php

protected function normalizeHeaderName($name)
{
    $out = [];
    array_map(function ($record) use (&$out) {
        $out[] = ucfirst(strtolower($record));
    }, explode('-', $name));
    return implode('-', $out);
}

for pregtr method in /lib/vendor/symfony/lib/util/sfToolkit.class.php on line 360

public static function pregtr($search, $replacePairs){
  foreach($replacePairs as $pattern => $replacement)
  {
    if (preg_match('/(.*)e$/', $pattern, $matches))
    {
      $pattern = $matches[1];
      $search = preg_replace_callback($pattern, function ($matches) use ($replacement) {
        preg_match("/('::'\.)?([a-z]*)\('\\\\([0-9]{1})'\)/", $replacement, $match);
        return ($match[1]==''?'':'::').call_user_func($match[2], $matches[$match[3]]);
      }, $search);
    }
    else
    {
      $search = preg_replace($pattern, $replacement, $search);
    }
  }
  return $search;
}

/lib/form/addon/sfFormObject.class.php on line 281

protected function camelize($text)
  {
    return strtr(ucwords(strtr($text, array('/' => ':: ', '_' => ' ', '-' => ' '))), array(' ' => ''));
  }

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *