Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
docker-compose.yml export-ignore
phpstan.neon export-ignore
phpunit.xml export-ignore
test/ export-ignore
/test/ export-ignore
tests/ export-ignore
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [thePanz]
2 changes: 2 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
memcached-version:
- "1.6"

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ All the enhancements and BC breaks are listed in the [WHATS_NEW](https://github.

- [DIC](https://github.com/FriendsOfSymfony1/symfony1/wiki/ServiceContainer)
- Composer support
- PHP 8.3 support
- PHP 8.4 support
- performance boost
- new widgets & validators
- some tickets fixed from the symfony trac
Expand All @@ -34,7 +34,7 @@ It runs on *nix and Windows platforms*.
Requirements
------------

PHP 5.3.4 and up. See prerequisites on https://symfony.com/legacy/doc/getting-started/1_4/en/02-Prerequisites
PHP 7.4 and up. See prerequisites on https://symfony.com/legacy/doc/getting-started/1_4/en/02-Prerequisites

Installation
------------
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ services:
- db
- memcached

php83:
<<: *services_php82
build:
args:
PHP_VERSION: '8.3'
MEMCACHE_VERSION: '8.2'
APCU_VERSION: '5.1.23'

php84:
<<: *services_php82
build:
args:
PHP_VERSION: '8.4'
MEMCACHE_VERSION: '8.2'
APCU_VERSION: '5.1.23'

db:
image: mysql:5.5.62
Expand Down
2 changes: 1 addition & 1 deletion lib/autoload/sfCoreAutoload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

// The current symfony version.
define('SYMFONY_VERSION', '1.6.2');
define('SYMFONY_VERSION', '1.6.4');

/**
* sfCoreAutoload class.
Expand Down
2 changes: 1 addition & 1 deletion lib/cache/sfCache.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function setOption($name, $value)
protected function patternToRegexp($pattern)
{
$regexp = str_replace(
['\\*\\*', '\\*'],
['\*\*', '\*'],
['.+?', '[^'.preg_quote(sfCache::SEPARATOR, '#').']+'],
preg_quote($pattern, '#')
);
Expand Down
2 changes: 1 addition & 1 deletion lib/command/sfCommandManager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function process($arguments = null)
}
} elseif (!is_array($arguments)) {
// hack to split arguments with spaces : --test="with some spaces"
$arguments = preg_replace_callback('/(\'|")(.+?)\\1/', function ($match) {
$arguments = preg_replace_callback('/(\'|")(.+?)\1/', function ($match) {
return str_replace(' ', '=PLACEHOLDER=', $match[2]);
}, $arguments);
$arguments = preg_split('/\s+/', $arguments);
Expand Down
2 changes: 1 addition & 1 deletion lib/debug/sfWebDebugPanel.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,6 @@ public function formatFileLink($file, $line = null, $text = null)
*/
public function formatSql($sql)
{
return preg_replace('/\b(UPDATE|SET|SELECT|FROM|AS|LIMIT|ASC|COUNT|DESC|WHERE|LEFT JOIN|INNER JOIN|RIGHT JOIN|ORDER BY|GROUP BY|IN|LIKE|DISTINCT|DELETE|INSERT|INTO|VALUES)\b/', '<span class="sfWebDebugLogInfo">\\1</span>', $sql);
return preg_replace('/\b(UPDATE|SET|SELECT|FROM|AS|LIMIT|ASC|COUNT|DESC|WHERE|LEFT JOIN|INNER JOIN|RIGHT JOIN|ORDER BY|GROUP BY|IN|LIKE|DISTINCT|DELETE|INSERT|INTO|VALUES)\b/', '<span class="sfWebDebugLogInfo">\1</span>', $sql);
}
}
8 changes: 4 additions & 4 deletions lib/debug/sfWebDebugPanelLogs.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getPanelContent()

++$line_nb;
$html .= sprintf(
"<tr class='sfWebDebugLogLine sfWebDebug%s %s'><td class=\"sfWebDebugLogNumber\">%s</td><td style=\"background-color:%s\">%s</td><td class=\"sfWebDebugLogType\">%s&nbsp;%s</td><td>%s %s</td></tr>\n",
"<tr class='sfWebDebugLogLine sfWebDebug%s %s'><td class=\"sfWebDebugLogNumber\">%s</td><td class=\"sfWebDebugLogType\">%s&nbsp;%s</td><td>%s %s</td></tr>\n",
ucfirst($priority),
$log['type'],
$line_nb,
Expand Down Expand Up @@ -121,9 +121,9 @@ protected function formatLogLine($logLine)

// replace constants value with constant name
$logLine = str_replace(array_keys($constants), array_values($constants), $logLine);
$logLine = preg_replace('/&quot;(.+?)&quot;/s', '<span class="sfWebDebugLogInfo">\\1</span>', $logLine);
$logLine = preg_replace('/^(.+?)\(\)\:/S', '<span class="sfWebDebugLogInfo">\\1()</span>:', $logLine);
$logLine = preg_replace('/line (\d+)$/', 'line <span class="sfWebDebugLogInfo">\\1</span>', $logLine);
$logLine = preg_replace('/&quot;(.+?)&quot;/s', '<span class="sfWebDebugLogInfo">\1</span>', $logLine);
$logLine = preg_replace('/^(.+?)\(\)\:/S', '<span class="sfWebDebugLogInfo">\1()</span>:', $logLine);
$logLine = preg_replace('/line (\d+)$/', 'line <span class="sfWebDebugLogInfo">\1</span>', $logLine);

// special formatting for SQL lines
$logLine = $this->formatSql($logLine);
Expand Down
5 changes: 4 additions & 1 deletion lib/exception/sfException.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,10 @@ protected static function fileExcerpt($file, $line)
}

if (is_readable($file)) {
$content = preg_split('#<br />#', preg_replace('/^<code>(.*)<\/code>$/s', '$1', highlight_file($file, true)));
$replaceRegex = '/^(?:<pre><code(?: [^>]+)?>|<code><span(?: [^>]+)?>\s*)(.*?)(?:<\/code><\/pre>|\s*<\/span>\s*<\/code>)$/s';
$splitRegex = '/(\r\n|\n|\r|<br \/>)/';

$content = preg_split($splitRegex, preg_replace($replaceRegex, '$1', highlight_file($file, true)));

$lines = [];
for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {
Expand Down
12 changes: 6 additions & 6 deletions lib/form/sfFormField.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class sfFormField
/**
* Constructor.
*
* @param sfWidgetForm $widget A sfWidget instance
* @param sfFormField $parent The sfFormField parent instance (null for the root widget)
* @param string $name The field name
* @param string $value The field value
* @param sfValidatorError $error A sfValidatorError instance
* @param sfWidgetForm $widget A sfWidget instance
* @param sfFormField|null $parent The sfFormField parent instance (null for the root widget)
* @param string $name The field name
* @param mixed $value The field value
* @param sfValidatorError|null $error A sfValidatorError instance
*/
public function __construct(sfWidgetForm $widget, ?sfFormField $parent = null, $name = null, $value = null, ?sfValidatorError $error = null)
public function __construct(sfWidgetForm $widget, ?sfFormField $parent = null, $name = '', $value = null, ?sfValidatorError $error = null)
{
$this->widget = $widget;
$this->parent = $parent;
Expand Down
12 changes: 6 additions & 6 deletions lib/form/sfFormFieldSchema.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class sfFormFieldSchema extends sfFormField implements ArrayAccess, Iterator, Co
/**
* Constructor.
*
* @param sfWidgetFormSchema $widget A sfWidget instance
* @param sfFormField $parent The sfFormField parent instance (null for the root widget)
* @param string $name The field name
* @param string $value The field value
* @param sfValidatorError $error A sfValidatorError instance
* @param sfWidgetFormSchema $widget A sfWidget instance
* @param sfFormField|null $parent The sfFormField parent instance (null for the root widget)
* @param string $name The field name
* @param mixed $value The field value
* @param sfValidatorError|null $error A sfValidatorError instance
*/
public function __construct(sfWidgetFormSchema $widget, ?sfFormField $parent = null, $name = null, $value = null, ?sfValidatorError $error = null)
public function __construct(sfWidgetFormSchema $widget, ?sfFormField $parent = null, $name = '', $value = null, ?sfValidatorError $error = null)
{
parent::__construct($widget, $parent, $name, $value, $error);

Expand Down
2 changes: 1 addition & 1 deletion lib/helper/EscapingHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function esc_js_no_entities($value)
{
return str_replace(
['\\', "\n", "\r", '"', "'"],
['\\\\', '\\n', '\\r', '\\"', "\\'"],
['\\\\', '\n', '\r', '\"', "\\'"],
$value
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/helper/TagHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function comment_as_conditional($condition, $content)
*/
function escape_javascript($javascript = '')
{
$javascript = preg_replace('/\r\n|\n|\r/', '\\n', $javascript);
$javascript = preg_replace('/\r\n|\n|\r/', '\n', $javascript);

return preg_replace('/(["\'])/', '\\\\\1', $javascript);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/helper/TextHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function truncate_text($text, $length = 30, $truncate_string = '...', $truncate_
*
* @return string
*/
function highlight_text($text, $phrase, $highlighter = '<strong class="highlight">\\1</strong>')
function highlight_text($text, $phrase, $highlighter = '<strong class="highlight">\1</strong>')
{
if (empty($text)) {
return '';
Expand Down Expand Up @@ -220,7 +220,7 @@ function auto_link_text($text, $link = 'all', $href_options = [], $truncate = fa
*/
function strip_links_text($text)
{
return preg_replace('/<a[^>]*>(.*?)<\/a>/s', '\\1', $text);
return preg_replace('/<a[^>]*>(.*?)<\/a>/s', '\1', $text);
}

if (!defined('SF_AUTO_LINK_RE')) {
Expand Down Expand Up @@ -254,7 +254,7 @@ function _auto_link_urls($text, $href_options = [], $truncate = false, $truncate
$href_options = _tag_options($href_options);

$callback_function = function ($matches) use ($href_options, $truncate, $truncate_len, $pad) {
if (preg_match('/<a\\s/i', $matches[1])) {
if (preg_match('/<a\s/i', $matches[1])) {
return $matches[0];
}

Expand All @@ -281,7 +281,7 @@ function _auto_link_urls($text, $href_options = [], $truncate = false, $truncate
function _auto_link_email_addresses($text)
{
// Taken from http://snippets.dzone.com/posts/show/6156
return preg_replace("#(^|[\n ])([a-z0-9&\\-_\\.]+?)@([\\w\\-]+\\.([\\w\\-\\.]+\\.)*[\\w]+)#i", '\\1<a href="mailto:\\2@\\3">\\2@\\3</a>', $text);
return preg_replace("#(^|[\n ])([a-z0-9&\\-_\\.]+?)@([\\w\\-]+\\.([\\w\\-\\.]+\\.)*[\\w]+)#i", '\1<a href="mailto:\2@\3">\2@\3</a>', $text);
// Removed since it destroys already linked emails
// Example: <a href="mailto:[email protected]">bar</a> gets <a href="mailto:[email protected]">bar</a> gets <a href="mailto:<a href="mailto:[email protected]">bar</a>
// return preg_replace('/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/', '<a href="mailto:\\1">\\1</a>', $text);
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/Gettext/MO.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ public function load($file = null)

// read all
for ($i = 0; $i < $count; ++$i) {
$this->strings[$this->_readStr($original[$i])] = $this->_readStr($translat[$i]);
$this->strings[$this->_readStr($original[$i])] =
$this->_readStr($translat[$i]);
}

// done
Expand Down
8 changes: 4 additions & 4 deletions lib/i18n/Gettext/PO.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public function load($file = null)

// match all msgid/msgstr entries
$matched = preg_match_all(
'/(msgid\s+("([^"]|\\\\")*?"\s*)+)\s+'.
'(msgstr\s+("([^"]|\\\\")*?"\s*)+)/',
'/(msgid\s+("([^"]|\\\")*?"\s*)+)\s+'.
'(msgstr\s+("([^"]|\\\")*?"\s*)+)/',
$contents,
$matches
);
Expand All @@ -81,12 +81,12 @@ public function load($file = null)
for ($i = 0; $i < $matched; ++$i) {
$msgid = preg_replace(
'/\s*msgid\s*"(.*)"\s*/s',
'\\1',
'\1',
$matches[1][$i]
);
$msgstr = preg_replace(
'/\s*msgstr\s*"(.*)"\s*/s',
'\\1',
'\1',
$matches[4][$i]
);
$this->strings[parent::prepare($msgid)] = parent::prepare($msgstr);
Expand Down
4 changes: 2 additions & 2 deletions lib/i18n/Gettext/TGettext.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ public function prepare($string, $reverse = false)
{
if ($reverse) {
$smap = ['"', "\n", "\t", "\r"];
$rmap = ['\"', '\\n"'."\n".'"', '\\t', '\\r'];
$rmap = ['\"', '\n"'."\n".'"', '\t', '\r'];

return (string) str_replace($smap, $rmap, $string);
}
$string = preg_replace('/"\s+"/', '', $string);
$smap = ['\\n', '\\r', '\\t', '\"'];
$smap = ['\n', '\r', '\t', '\"'];
$rmap = ["\n", "\r", "\t", '"'];

return (string) str_replace($smap, $rmap, $string);
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/sfDateFormat.class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* sfDateFormat class file.
*
Expand Down Expand Up @@ -211,7 +212,7 @@ public function format($time, $pattern = 'F', $inputPattern = null, $charset = '
$tokens[$i] = '\'';
} else {
$function = $this->getFunctionName($pattern);
if (null != $function) {
if (null !== $function) {
$function = ucfirst($function);
$fName = 'get'.$function;
if (in_array($fName, $this->methods)) {
Expand Down
1 change: 1 addition & 0 deletions lib/log/sfPsrLoggerAdapter.class.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of the symfony package.
* (c) Fabien Potencier <[email protected]>
Expand Down
8 changes: 1 addition & 7 deletions lib/log/sfWebDebugLogger.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public function initialize(sfEventDispatcher $dispatcher, $options = [])
* PHP error handler send PHP errors to log.
*
* PHP user space error handler can not handle E_ERROR, E_PARSE,
* E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING,
* and most of E_STRICT.
* E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR and E_COMPILE_WARNING.
*
* @param string $errno the level of the error raised, as an integer
* @param string $errstr the error message, as a string
Expand All @@ -76,11 +75,6 @@ public function handlePhpError($errno, $errstr, $errfile, $errline, $errcontext
$message = sprintf(' %%s at %s on line %s (%s)', $errfile, $errline, str_replace('%', '%%', $errstr));

switch ($errno) {
case E_STRICT:
$this->dispatcher->notify(new sfEvent($this, 'application.log', ['priority' => sfLogger::ERR, sprintf($message, 'Strict notice')]));

break;

case E_NOTICE:
$this->dispatcher->notify(new sfEvent($this, 'application.log', ['priority' => sfLogger::NOTICE, sprintf($message, 'Notice')]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ public function getI18nModel()

public function underscore($name)
{
return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\\1_\\2', $name));
return strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $name));
}

/**
Expand All @@ -567,13 +567,13 @@ public function getColumns()
if ($parentModel) {
$parentRelationNames = array_keys(Doctrine_Core::getTable($parentModel)->getRelations());
$relations = $this->table->getRelations();

$relationColumns = [];
foreach (array_diff(array_keys($relations), $parentRelationNames) as $relationName) {
if (Doctrine_Relation::ONE == $relations[$relationName]->getType()) {
$columnName = $relations[$relationName]->getLocal();
if (!in_array($columnName, $names)) {
if (!in_array($columnName, $relationColumns)) {
$relationColumns[] = $columnName;
$columns[] = new sfDoctrineColumn($columnName, $this->table);
$names[] = $columnName;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,12 @@ protected function getDoctrineDatabases(sfDatabaseManager $databaseManager, ?arr
protected function prepareSchemaFile($yamlSchemaPath)
{
$models = [];
$finder = sfFinder::type('file')
->name('*.yml')
->sort_by_name()
->follow_link()
;
$finder = sfFinder::type('file')->name('*.yml')->sort_by_name()->follow_link();

// plugin models
foreach ($this->configuration->getPlugins() as $name) {
$plugin = $this->configuration->getPluginConfiguration($name);
foreach ($finder->in("{$plugin->getRootDir()}/config/doctrine") as $schema) {
foreach ($finder->in($plugin->getRootDir().'/config/doctrine') as $schema) {
$pluginModels = (array) sfYaml::load($schema);
$globals = $this->filterSchemaGlobals($pluginModels);

Expand All @@ -142,11 +138,11 @@ protected function prepareSchemaFile($yamlSchemaPath)

// the first plugin to define this model gets the package
if (!isset($models[$model]['package'])) {
$models[$model]['package'] = "{$plugin->getName()}.lib.model.doctrine";
$models[$model]['package'] = $plugin->getName().'.lib.model.doctrine';
}

if (!isset($models[$model]['package_custom_path']) && 0 === strpos($models[$model]['package'], $plugin->getName())) {
$models[$model]['package_custom_path'] = "{$plugin->getRootDir()}/lib/model/doctrine";
$models[$model]['package_custom_path'] = $plugin->getRootDir().'/lib/model/doctrine';
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function execute($arguments = [], $options = [])

// create a route
$model = $arguments['route_or_model'];
$name = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\\1_\\2', $model));
$name = strtolower(preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], '\1_\2', $model));

if (isset($options['module'])) {
$route = $this->getRouteFromName($name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function debug($limit = null)

if (is_integer($limit)) {
$events = array_slice($events, $limit * -1);
} elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $limit, $match)) {
} elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\]).+?\2[ims]?$/', $limit, $match)) {
if ('!' == $match[1]) {
$pattern = substr($limit, 1);
$match = false;
Expand Down
Loading