Skip to content
Merged
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
20 changes: 14 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
os: linux
dist: xenial
dist: focal
language: php

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
- nightly

cache:
Expand All @@ -18,15 +16,25 @@ jobs:
fast_finish: true
allow_failures:
- php: nightly
- php: 5.3
include:
- php: 5.3
dist: precise
- php: 5.4
dist: precise
dist: trusty
- php: 5.5
dist: trusty
- php: 5.6
dist: trusty
- php: 7.0
dist: xenial
- php: 7.1
dist: xenial
- php: 7.2
dist: xenial
- php: 7.3
dist: xenial


services:
- mysql
Expand Down
5 changes: 5 additions & 0 deletions lib/Doctrine/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function __isset($name)
* @param string $name
* @return void
*/
#[\ReturnTypeWillChange]
public function __unset($name)
{
return $this->remove($name);
Expand All @@ -100,6 +101,7 @@ public function __unset($name)
* @param mixed $offset
* @return boolean Whether or not this object contains $offset
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return $this->contains($offset);
Expand All @@ -112,6 +114,7 @@ public function offsetExists($offset)
* @param mixed $offset
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
// array notation with no index was causing 'undefined variable: $offset' notices in php7,
Expand All @@ -131,6 +134,7 @@ public function offsetGet($offset)
* @param mixed $value
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
if ( ! isset($offset)) {
Expand All @@ -146,6 +150,7 @@ public function offsetSet($offset, $value)
* @see set, offsetSet, __set
* @param mixed $offset
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
return $this->remove($offset);
Expand Down
1 change: 1 addition & 0 deletions lib/Doctrine/Adapter/Mock.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public function lastInsertId()
*
* @return integer $count
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->_queries);
Expand Down
40 changes: 33 additions & 7 deletions lib/Doctrine/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,38 @@ public function setData(array $data)
$this->data = $data;
}


/**
* This method is automatically called when this Doctrine_Collection is serialized
*
* @return array
* @return string
*/
public function serialize()
{
$vars = $this->__serialize();

return serialize($vars);
}

/**
* This method is automatically called everytime a Doctrine_Collection object is unserialized
*
* @return void
*/
public function unserialize($serialized)
{
$array = unserialize($serialized);

$this->__unserialize($array);
}

/**
* Serializes the current instance for php 7.4+
*
* @return array
*/
public function __serialize() {

$vars = get_object_vars($this);

unset($vars['reference']);
Expand All @@ -160,22 +185,21 @@ public function serialize()

$vars['_table'] = $vars['_table']->getComponentName();

return serialize($vars);
return $vars;
}

/**
* This method is automatically called everytime a Doctrine_Collection object is unserialized
* Unserializes a Doctrine_Collection instance for php 7.4+
*
* @return void
* @param string $serialized A serialized Doctrine_Collection instance
*/
public function unserialize($serialized)
public function __unserialize($data)
{
$manager = Doctrine_Manager::getInstance();
$connection = $manager->getCurrentConnection();

$array = unserialize($serialized);

foreach ($array as $name => $values) {
foreach ($data as $name => $values) {
$this->$name = $values;
}

Expand Down Expand Up @@ -432,6 +456,7 @@ public function getKeys()
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->data);
Expand Down Expand Up @@ -1036,6 +1061,7 @@ public function free($deep = false)
*
* @return Iterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
$data = $this->data;
Expand Down
5 changes: 5 additions & 0 deletions lib/Doctrine/Collection/OnDemand.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private function _hydrateCurrent()
}
}

#[\ReturnTypeWillChange]
public function rewind()
{
$this->index = 0;
Expand All @@ -73,23 +74,27 @@ public function rewind()
$this->_hydrateCurrent();
}

#[\ReturnTypeWillChange]
public function key()
{
return $this->index;
}

#[\ReturnTypeWillChange]
public function current()
{
return $this->_current;
}

#[\ReturnTypeWillChange]
public function next()
{
$this->_current = null;
$this->index++;
$this->_hydrateCurrent();
}

#[\ReturnTypeWillChange]
public function valid()
{
if ( ! is_null($this->_current) && $this->_current !== false) {
Expand Down
35 changes: 31 additions & 4 deletions lib/Doctrine/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,7 @@ public function getTables()
*
* @return ArrayIterator SPL ArrayIterator object
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->tables);
Expand All @@ -1188,6 +1189,7 @@ public function getIterator()
*
* @return integer
*/
#[\ReturnTypeWillChange]
public function count()
{
return $this->_count;
Expand Down Expand Up @@ -1606,16 +1608,16 @@ public function __toString()
return Doctrine_Lib::getConnectionAsString($this);
}


/**
* Serialize. Remove database connection(pdo) since it cannot be serialized
*
* @return string $serialized
*/
public function serialize()
{
$vars = get_object_vars($this);
$vars['dbh'] = null;
$vars['isConnected'] = false;
$vars = $this->__serialize();

return serialize($vars);
}

Expand All @@ -1629,7 +1631,32 @@ public function unserialize($serialized)
{
$array = unserialize($serialized);

foreach ($array as $name => $values) {
$this->__unserialize($array);
}

/**
* Serialize. Remove database connection(pdo) since it cannot be serialized for PHP 7.4+
*
* @return array
*/
public function __serialize()
{
$vars = get_object_vars($this);
$vars['dbh'] = null;
$vars['isConnected'] = false;

return $vars;
}

/**
* Unserialize. Recreate connection from serialized content PHP 7.4+
*
* @param array $data
* @return void
*/
public function __unserialize($data)
{
foreach ($data as $name => $values) {
$this->$name = $values;
}
}
Expand Down
5 changes: 5 additions & 0 deletions lib/Doctrine/Connection/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ public function __construct(Doctrine_Manager $manager, $adapter)

$this->properties['varchar_max_length'] = 255;

// PHP8.1 require default to true to keep BC
// https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql
// Can be overwritten by user later
$this->setAttribute(Doctrine_Core::ATTR_STRINGIFY_FETCHES, true);

parent::__construct($manager, $adapter);
}

Expand Down
22 changes: 12 additions & 10 deletions lib/Doctrine/Connection/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public function __construct() {
* @return boolean
*/
public function setFilterQueryType() {
}

}
/**
* method overloader
* this method is used for invoking different listeners, for the full
Expand Down Expand Up @@ -107,9 +107,9 @@ public function __call($m, $a)
* get
*
* @param mixed $key
* @return Doctrine_Event
* @return Doctrine_Event|null
*/
public function get($key)
public function get($key)
{
if (isset($this->events[$key])) {
return $this->events[$key];
Expand All @@ -121,9 +121,9 @@ public function get($key)
* getAll
* returns all profiled events as an array
*
* @return array all events in an array
* @return Doctrine_Event[] All events in an array
*/
public function getAll()
public function getAll()
{
return $this->events;
}
Expand All @@ -134,27 +134,29 @@ public function getAll()
*
* @return ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->events);
}

/**
* count
*
*
* @return integer
*/
public function count()
#[\ReturnTypeWillChange]
public function count()
{
return count($this->events);
}

/**
* pop the last event from the event stack
*
* @return Doctrine_Event
* @return Doctrine_Event|null
*/
public function pop()
public function pop()
{
$event = array_pop($this->events);
if ($event !== null)
Expand Down
Loading