Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply updates for PHP 8.x #1909

Open
wants to merge 15 commits into
base: qa/2.x
Choose a base branch
from
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
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7.4-fpm-alpine
FROM php:8.2-fpm-alpine

ENV FOP_HOME=/usr/share/fop-2.1 \
COMPOSER_ALLOW_SUPERUSER=1 \
Expand All @@ -15,6 +15,7 @@ RUN set -xe \
autoconf \
build-base \
openldap-dev \
linux-headers \
&& docker-php-ext-install \
calendar \
gettext \
Expand All @@ -28,10 +29,10 @@ RUN set -xe \
zip \
ldap \
&& pecl install apcu pcov \
&& curl -Ls https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.tar.gz | tar xz -C / \
&& cd /pecl-memcache-NON_BLOCKING_IO_php7 \
&& curl -Ls https://github.com/websupport-sk/pecl-memcache/archive/refs/tags/8.2.tar.gz | tar xz -C / \
&& cd /pecl-memcache-8.2 \
&& phpize && ./configure && make && make install \
&& cd / && rm -rf /pecl-memcache-NON_BLOCKING_IO_php7 \
&& cd / && rm -rf /pecl-memcache-8.2 \
&& docker-php-ext-enable apcu memcache pcov \
&& apk add --no-cache --virtual .phpext-rundeps \
gettext \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private function getAdvancedFilterTerms()
private function setI18nFieldCultures()
{
foreach (self::$AGGS as $key => &$value) {
if (false !== array_search('i18n.%s', $value['field'])) {
if (is_array($value['field']) && false !== array_search('i18n.%s', $value['field'])) {
$value['field'] = sprintf($value['field'], $this->context->user->getCulture());
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/helper/QubitHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function render_b5_field($field, $translation = null, $options = [])
$widget = $field->getWidget();

if (
in_array($field->type, ['checkbox', 'radio'])
in_array($widget->getOption('type'), ['checkbox', 'radio'])
|| $widget instanceof sfWidgetFormSelectRadio
|| (
$widget instanceof sfWidgetFormChoice
Expand All @@ -113,7 +113,7 @@ function render_b5_field($field, $translation = null, $options = [])
$isFormCheck = true;
$inputClass = 'form-check-input';
$labelClass = 'form-check-label';
} elseif ('color' == $field->type) {
} elseif ('color' == $widget->getOption('type')) {
$inputClass .= ' form-control-color';
}

Expand Down Expand Up @@ -773,7 +773,7 @@ function render_autocomplete_string($hit)
}

if (0 < count($levelOfDescriptionAndIdentifier)) {
$string[] = implode($levelOfDescriptionAndIdentifier, ' ');
$string[] = implode(' ', $levelOfDescriptionAndIdentifier);
}

$titleAndPublicationStatus = [];
Expand All @@ -787,7 +787,7 @@ function render_autocomplete_string($hit)
}

if (0 < count($titleAndPublicationStatus)) {
$string[] = implode($titleAndPublicationStatus, ' ');
$string[] = implode(' ', $titleAndPublicationStatus);
}

return implode(' - ', $string);
Expand Down
2 changes: 1 addition & 1 deletion lib/job/arGearman.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static function getAbilities($options = [])
$abilities = array_merge($abilities, $config['worker_types'][$type]);
}
} else {
$abilities = call_user_func_array('array_merge', $config['worker_types']);
$abilities = call_user_func_array('array_merge', array_values($config['worker_types']));
}

return $abilities;
Expand Down
4 changes: 2 additions & 2 deletions lib/model/QubitActor.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function __get($name)
return [];
}

return call_user_func_array([$this, 'BaseActor::__get'], $args);
return call_user_func_array('BaseActor::__get', $args);
}

public function __set($name, $value)
Expand Down Expand Up @@ -104,7 +104,7 @@ public function __set($name, $value)
return $this;
}

return call_user_func_array([$this, 'BaseActor::__set'], $args);
return call_user_func_array('BaseActor::__set', $args);
}

public function save($connection = null)
Expand Down
6 changes: 3 additions & 3 deletions lib/model/QubitInformationObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function __get($name)
case 'sourceStandard':
foreach ($this->ancestors->andSelf()->orderBy('rgt') as $item) {
if (isset($item->sourceStandard)) {
return call_user_func_array([$item, 'QubitObject::__get'], $args);
return call_user_func_array('QubitObject::__get', $args);
}

// Stop iteration before the root object is reached
Expand All @@ -135,7 +135,7 @@ public function __get($name)
break;

default:
return call_user_func_array([$this, 'BaseInformationObject::__get'], $args);
return call_user_func_array('BaseInformationObject::__get', $args);
}
}

Expand Down Expand Up @@ -172,7 +172,7 @@ public function __set($name, $value)
return $this;

default:
return call_user_func_array([$this, 'BaseInformationObject::__set'], $args);
return call_user_func_array('BaseInformationObject::__set', $args);
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/model/QubitObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __isset($name)
return isset($this->values['slug']);

default:
return call_user_func_array([$this, 'BaseObject::__isset'], $args);
return call_user_func_array('BaseObject::__isset', $args);
}
}

Expand All @@ -69,7 +69,7 @@ public function __get($name)
return $this->values['slug'];

default:
return call_user_func_array([$this, 'BaseObject::__get'], $args);
return call_user_func_array('BaseObject::__get', $args);
}
}

Expand All @@ -84,7 +84,7 @@ public function __set($name, $value)
return $this;

default:
return call_user_func_array([$this, 'BaseObject::__set'], $args);
return call_user_func_array('BaseObject::__set', $args);
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/model/QubitRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __get($name)
break;

default:
return call_user_func_array([$this, 'BaseRepository::__get'], $args);
return call_user_func_array('BaseRepository::__get', $args);
}
}

Expand Down Expand Up @@ -88,7 +88,7 @@ public function __set($name, $value)
return $this;

default:
return call_user_func_array([$this, 'BaseRepository::__set'], $args);
return call_user_func_array('BaseRepository::__set', $args);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/model/QubitSlug.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static function slugify($slug, $creationType = null)
$slugCreation = (null === $creationType) ? sfConfig::get('app_permissive_slug_creation', QubitSlug::SLUG_RESTRICTIVE) : $creationType;

// Remove apostrophes from slug
$slug = preg_replace('/\'/', '', $slug);
$slug = preg_replace('/\'/', '', (string) $slug);

switch ($slugCreation) {
case QubitSlug::SLUG_PERMISSIVE:
Expand Down
10 changes: 5 additions & 5 deletions lib/model/om/BaseActor.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function __isset($name)

try
{
return call_user_func_array(array($this, 'QubitObject::__isset'), $args);
return call_user_func_array('QubitObject::__isset', $args);
}
catch (sfException $e)
{
Expand Down Expand Up @@ -149,7 +149,7 @@ public function __get($name)

try
{
return call_user_func_array(array($this, 'QubitObject::__get'), $args);
return call_user_func_array('QubitObject::__get', $args);
}
catch (sfException $e)
{
Expand Down Expand Up @@ -242,7 +242,7 @@ public function __get($name)

try
{
if (1 > strlen($value = call_user_func_array(array($this->getCurrentactorI18n($options), '__get'), $args)) && !empty($options['cultureFallback']))
if (1 > strlen((string) $value = call_user_func_array(array($this->getCurrentactorI18n($options), '__get'), $args)) && !empty($options['cultureFallback']))
{
return call_user_func_array(array($this->getCurrentactorI18n(array('sourceCulture' => true) + $options), '__get'), $args);
}
Expand All @@ -266,7 +266,7 @@ public function __set($name, $value)
$options = $args[2];
}

call_user_func_array(array($this, 'QubitObject::__set'), $args);
call_user_func_array('QubitObject::__set', $args);

call_user_func_array(array($this->getCurrentactorI18n($options), '__set'), $args);

Expand All @@ -283,7 +283,7 @@ public function __unset($name)
$options = $args[1];
}

call_user_func_array(array($this, 'QubitObject::__unset'), $args);
call_user_func_array('QubitObject::__unset', $args);

call_user_func_array(array($this->getCurrentactorI18n($options), '__unset'), $args);

Expand Down
4 changes: 4 additions & 0 deletions lib/model/om/BaseActorI18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public function __isset($name)
throw new sfException("Unknown record property \"$name\" on \"".get_class($this).'"');
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
$args = func_get_args();
Expand Down Expand Up @@ -250,6 +251,7 @@ public function __get($name)
throw new sfException("Unknown record property \"$name\" on \"".get_class($this).'"');
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$args = func_get_args();
Expand Down Expand Up @@ -304,6 +306,7 @@ public function __set($name, $value)
return $this;
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$args = func_get_args();
Expand Down Expand Up @@ -335,6 +338,7 @@ public function __unset($name)
return $this;
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$args = func_get_args();
Expand Down
4 changes: 4 additions & 0 deletions lib/model/om/BaseContactInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public function __isset($name)
throw new sfException("Unknown record property \"$name\" on \"".get_class($this).'"');
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
$args = func_get_args();
Expand Down Expand Up @@ -299,6 +300,7 @@ public function __get($name)
throw new sfException("Unknown record property \"$name\" on \"".get_class($this).'"');
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$args = func_get_args();
Expand Down Expand Up @@ -355,6 +357,7 @@ public function __set($name, $value)
return $this;
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$args = func_get_args();
Expand Down Expand Up @@ -396,6 +399,7 @@ public function __unset($name)
return $this;
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$args = func_get_args();
Expand Down
10 changes: 5 additions & 5 deletions lib/model/om/BaseInformationObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function __isset($name)

try
{
return call_user_func_array(array($this, 'QubitObject::__isset'), $args);
return call_user_func_array('QubitObject::__isset', $args);
}
catch (sfException $e)
{
Expand Down Expand Up @@ -178,7 +178,7 @@ public function __get($name)

try
{
return call_user_func_array(array($this, 'QubitObject::__get'), $args);
return call_user_func_array('QubitObject::__get', $args);
}
catch (sfException $e)
{
Expand Down Expand Up @@ -237,7 +237,7 @@ public function __get($name)

try
{
if (1 > strlen($value = call_user_func_array(array($this->getCurrentinformationObjectI18n($options), '__get'), $args)) && !empty($options['cultureFallback']))
if (1 > strlen((string) $value = call_user_func_array(array($this->getCurrentinformationObjectI18n($options), '__get'), $args)) && !empty($options['cultureFallback']))
{
return call_user_func_array(array($this->getCurrentinformationObjectI18n(array('sourceCulture' => true) + $options), '__get'), $args);
}
Expand Down Expand Up @@ -301,7 +301,7 @@ public function __set($name, $value)
$options = $args[2];
}

call_user_func_array(array($this, 'QubitObject::__set'), $args);
call_user_func_array('QubitObject::__set', $args);

call_user_func_array(array($this->getCurrentinformationObjectI18n($options), '__set'), $args);

Expand All @@ -318,7 +318,7 @@ public function __unset($name)
$options = $args[1];
}

call_user_func_array(array($this, 'QubitObject::__unset'), $args);
call_user_func_array('QubitObject::__unset', $args);

call_user_func_array(array($this->getCurrentinformationObjectI18n($options), '__unset'), $args);

Expand Down
4 changes: 4 additions & 0 deletions lib/model/om/BaseInformationObjectI18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public function __isset($name)
throw new sfException("Unknown record property \"$name\" on \"".get_class($this).'"');
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
$args = func_get_args();
Expand Down Expand Up @@ -266,6 +267,7 @@ public function __get($name)
throw new sfException("Unknown record property \"$name\" on \"".get_class($this).'"');
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$args = func_get_args();
Expand Down Expand Up @@ -320,6 +322,7 @@ public function __set($name, $value)
return $this;
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$args = func_get_args();
Expand Down Expand Up @@ -351,6 +354,7 @@ public function __unset($name)
return $this;
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$args = func_get_args();
Expand Down
4 changes: 4 additions & 0 deletions lib/model/om/BaseNote.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public function __isset($name)
throw new sfException("Unknown record property \"$name\" on \"".get_class($this).'"');
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
$args = func_get_args();
Expand Down Expand Up @@ -279,6 +280,7 @@ public function __get($name)
throw new sfException("Unknown record property \"$name\" on \"".get_class($this).'"');
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
$args = func_get_args();
Expand Down Expand Up @@ -335,6 +337,7 @@ public function __set($name, $value)
return $this;
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$args = func_get_args();
Expand Down Expand Up @@ -376,6 +379,7 @@ public function __unset($name)
return $this;
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
$args = func_get_args();
Expand Down
Loading
Loading