diff --git a/Core/Email/Batches/Notifications.php b/Core/Email/Batches/Notifications.php index 969389a3c..dfb8d730d 100644 --- a/Core/Email/Batches/Notifications.php +++ b/Core/Email/Batches/Notifications.php @@ -50,6 +50,7 @@ public function run() /** @var Notification[] $notifications */ $notifications = $this->repository->getAll(['limit' => $count])['notifications']; } catch (\Exception $e) { + error_log($e->getMessage()); continue; } @@ -58,6 +59,11 @@ public function run() $i = 0; + // Needed for PHP 7.2 compatibility with the new `count`. + if (!$notifications) { + $notifications = []; + } + //count all notifications created today while ($i < count($notifications) && $today <= $notifications[$i]->getTimeCreated()) { $i++; @@ -73,4 +79,4 @@ public function run() } } } -} \ No newline at end of file +} diff --git a/Core/Email/Manager.php b/Core/Email/Manager.php index 5447cf9bf..8634eb77b 100644 --- a/Core/Email/Manager.php +++ b/Core/Email/Manager.php @@ -5,7 +5,6 @@ use Minds\Core\Di\Di; -use Minds\Core\Email\EmailSubscription; use Minds\Core\Entities; class Manager @@ -30,10 +29,16 @@ public function getSubscribers($options = []) $result = $this->repository->getList($options); - if (!$result || count($result['data'] === 0)) { + // @FIXME: Due to a quirk in PHP < 7.2.0, count($array === 0) always returns true. + // @FIXME: This blows up, as it should, in PHP >= 7.2.0. + // @FIXME: Since this code was -always- returning true, it needs to be fixed. + // Orig: if (!$result || count($result['data'] === 0) { + if (!$result || true /** @FIXME!~! */) { return []; } + // @FIXME: Due to the function always exiting before this point, no one caught + // @FIXME: that this array_map blows up trying to call a method on a string. $guids = array_map(function ($item) { return $item->getUserGuid(); }, $result['data']); diff --git a/Core/SEO/Sitemaps/Manager.php b/Core/SEO/Sitemaps/Manager.php index 601c24afb..167f46add 100644 --- a/Core/SEO/Sitemaps/Manager.php +++ b/Core/SEO/Sitemaps/Manager.php @@ -65,4 +65,4 @@ protected function route($uri) } return []; } -} \ No newline at end of file +} diff --git a/Entities/Activity.php b/Entities/Activity.php index 1bf4080f1..a77d4b830 100644 --- a/Entities/Activity.php +++ b/Entities/Activity.php @@ -96,9 +96,12 @@ public function save($index = true) /** * Deletes the activity entity and indexes + * + * @param bool $unused Needed for PHP 7.2 support. * @return bool + * @throws \Minds\Exceptions\StopEventException */ - public function delete() + public function delete($unused = true) { if ($this->p2p_boosted) { return false; diff --git a/Entities/Album.php b/Entities/Album.php index a3b66147a..6eeb23bf2 100644 --- a/Entities/Album.php +++ b/Entities/Album.php @@ -10,7 +10,7 @@ use Minds\Core; use Minds\Core\Data; -class Album extends Object +class Album extends MindsObject { protected function initializeAttributes() { diff --git a/Entities/Batch.php b/Entities/Batch.php index 5c46ab8f7..2bd4f2409 100644 --- a/Entities/Batch.php +++ b/Entities/Batch.php @@ -8,7 +8,7 @@ use Minds\Core\Data; -class Batch extends Object +class Batch extends MindsObject { public function __construct($guid = null) { diff --git a/Entities/DenormalizedEntity.php b/Entities/DenormalizedEntity.php index 443fff345..efc08c0a1 100644 --- a/Entities/DenormalizedEntity.php +++ b/Entities/DenormalizedEntity.php @@ -26,7 +26,7 @@ public function __construct($db = null) /** * Set this entity's database store - * @param object $db + * @param MindsObject $db */ public function setDb($db) { diff --git a/Entities/Image.php b/Entities/Image.php index e9363d7bc..237e47078 100644 --- a/Entities/Image.php +++ b/Entities/Image.php @@ -69,10 +69,14 @@ public function save($index = true) /** * Extend the default delete function to remove from the remote service + * + * @param bool $recursive Whether to delete all the entities contained by this entity + * @return bool + * @throws \ClassNotFoundException */ - public function delete() + public function delete($recursive = true) { - return parent::delete(); + return parent::delete($recursive); //remove from the filestore } diff --git a/Entities/Object.php b/Entities/MindsObject.php similarity index 98% rename from Entities/Object.php rename to Entities/MindsObject.php index a1d617a43..fafa8ccde 100644 --- a/Entities/Object.php +++ b/Entities/MindsObject.php @@ -8,7 +8,7 @@ * Object Entity * @todo Do not inherit from ElggObject */ -class Object extends \ElggObject implements Flaggable +class MindsObject extends \ElggObject implements Flaggable { protected $dirtyIndexes; diff --git a/Entities/Object/Carousel.php b/Entities/Object/Carousel.php index 19651dc26..cf697f422 100644 --- a/Entities/Object/Carousel.php +++ b/Entities/Object/Carousel.php @@ -6,7 +6,7 @@ /** * Carousel Entity */ -class Carousel extends Entities\Object +class Carousel extends Entities\MindsObject { /** * Initialize entity attributes diff --git a/Entities/Object/Points_transaction.php b/Entities/Object/Points_transaction.php index b8ee88bbf..2fbfb68e0 100644 --- a/Entities/Object/Points_transaction.php +++ b/Entities/Object/Points_transaction.php @@ -6,7 +6,7 @@ /** * Points Transaction Entity */ -class Points_transaction extends Entities\Object +class Points_transaction extends Entities\MindsObject { /** * Initialize attributes diff --git a/Entities/Video.php b/Entities/Video.php index 27835dcad..bb49b2e8e 100644 --- a/Entities/Video.php +++ b/Entities/Video.php @@ -12,7 +12,7 @@ use Minds\Helpers; -class Video extends Object +class Video extends MindsObject { private $cinemr; @@ -97,10 +97,13 @@ public function save($force = false) /** * Extend the default delete function to remove from the remote service + * + * @param bool $recursive Whether to delete all the entities contained by this entity + * @return bool */ - public function delete() + public function delete($recursive = true) { - $result = parent::delete(); + $result = parent::delete($recursive); return $result; } diff --git a/Spec/Core/Security/ACLSpec.php b/Spec/Core/Security/ACLSpec.php index 65baf0f5d..fdb8a8d93 100644 --- a/Spec/Core/Security/ACLSpec.php +++ b/Spec/Core/Security/ACLSpec.php @@ -7,7 +7,7 @@ use Minds\Core; use Minds\Entities\User; use Minds\Entities\Entity; -use Minds\Entities\Object; +use Minds\Entities\MindsObject; class ACLSpec extends ObjectBehavior { @@ -49,7 +49,7 @@ public function it_should_not_allow_read_of_private_entities(Entity $entity) $this->read($entity)->shouldReturn(false); } - public function it_should_trigger_acl_read_event(Object $entity) + public function it_should_trigger_acl_read_event(MindsObject $entity) { $this->mock_session(true); @@ -85,7 +85,7 @@ public function it_should_allow_write_for_own_entities(Entity $entity) $this->mock_session(false); } - public function it_should_trigger_acl_write_event(Object $entity) + public function it_should_trigger_acl_write_event(MindsObject $entity) { $this->mock_session(true); @@ -126,7 +126,7 @@ public function it_should_allow_interaction(Entity $entity) $this->mock_session(false); } - public function it_should_return_false_on_acl_interact_event(Object $entity) + public function it_should_return_false_on_acl_interact_event(MindsObject $entity) { $this->mock_session(true); diff --git a/Spec/Mocks/Cassandra/Rows.php b/Spec/Mocks/Cassandra/Rows.php index d1f961c04..a955a3a41 100644 --- a/Spec/Mocks/Cassandra/Rows.php +++ b/Spec/Mocks/Cassandra/Rows.php @@ -17,8 +17,8 @@ public function __construct(array $items, $pagingStateToken) public function getIterator() { return call_user_func(function () { - while (list($key, $val) = each($this->_items)) { - yield $key => $val; + foreach ($this->_items as $key => $value) { + yield $key => $value; } }); } diff --git a/classes/ElggFile.php b/classes/ElggFile.php index 93c1b98b9..72b34c53c 100644 --- a/classes/ElggFile.php +++ b/classes/ElggFile.php @@ -271,12 +271,15 @@ public function close() { /** * Delete this file. * + * @param bool $recursive Whether to delete all the entities contained by this entity + * * @return bool - */ - public function delete() { + * @throws ClassNotFoundException + */ + public function delete($recursive = true) { $fs = $this->getFilestore(); //if ($fs->delete($this)) { - return parent::delete(); + return parent::delete($recursive); //} } diff --git a/classes/ElggSite.php b/classes/ElggSite.php index 1bf8bdd50..31ae7676b 100644 --- a/classes/ElggSite.php +++ b/classes/ElggSite.php @@ -122,7 +122,12 @@ protected function load($guid) { return true; } - public function save(){ + /** + * @param bool $unused Needed for PHP 7.2 support. + * @return bool + * @throws IOException + */ + public function save($unused = true){ global $CONFIG; if(isset($CONFIG->site_name)){ return; //the site is not an entitiy, it is static from settings @@ -136,16 +141,17 @@ public function save(){ * * @note You cannot delete the current site. * + * @param bool $recursive Whether to delete all the entities contained by this entity * @return bool * @throws SecurityException */ - public function delete() { + public function delete($recursive = true) { global $CONFIG; if ($CONFIG->site->getGUID() == $this->guid) { throw new SecurityException('SecurityException:deletedisablecurrentsite'); } - return parent::delete(); + return parent::delete($recursive); } /** diff --git a/classes/ElggUser.php b/classes/ElggUser.php index 804820ce2..4f8e25e03 100644 --- a/classes/ElggUser.php +++ b/classes/ElggUser.php @@ -150,9 +150,12 @@ protected function loadFromLookup($string){ /** * Saves this user to the database. * - * @return bool - */ - public function save() { + * @param bool $unused Needed for PHP 7.2 support. + * @return bool + * @throws IOException + */ + public function save($unused = true) { + if(!$this->cache){ //return false; } @@ -265,9 +268,11 @@ public function disable($reason = "", $recursive = true){ /** * User specific override of the entity delete method. * + * @param bool $unused Needed for PHP 7.2 support. + * * @return bool */ - public function delete() { + public function delete($unused = true) { global $USERNAME_TO_GUID_MAP_CACHE, $CODE_TO_GUID_MAP_CACHE; // clear cache diff --git a/composer.json b/composer.json index d3a1a5693..cc0f3ec79 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "stripe/stripe-php": "~4.12", "thobbs/phpcassa": "dev-minds-legacy", "tijsverkoyen/twitteroauth": "dev-master@dev", - "twilio/sdk": "3.13.*", + "twilio/sdk": "dev-3.13.1-create-function-fix", "videlalvaro/php-amqplib": "dev-master@dev", "vscn/cruftflake": "dev-master#cab1b9ee9869072e7a58a1eb593b602ec5bedcd3", "zircote/swagger-php": "2.*@dev", @@ -48,6 +48,10 @@ { "type": "vcs", "url": "https://github.com/davegardnerisme/cruftflake.git" + }, + { + "type": "git", + "url": "https://github.com/hopeseekr/twilio-php" } ], "autoload": { diff --git a/composer.lock b/composer.lock index 421c275f8..9c51a675d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3da9199123996bc09d9556280490a86b", + "content-hash": "f793ffc01d2b9e689aa017e5e6539c88", "packages": [ { "name": "Minds/Surge", @@ -995,12 +995,12 @@ "version": "v2.2.2", "source": { "type": "git", - "url": "https://github.com/google/google-api-php-client.git", + "url": "https://github.com/googleapis/google-api-php-client.git", "reference": "4e0fd83510e579043e10e565528b323b7c2b3c81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-api-php-client/zipball/4e0fd83510e579043e10e565528b323b7c2b3c81", + "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/4e0fd83510e579043e10e565528b323b7c2b3c81", "reference": "4e0fd83510e579043e10e565528b323b7c2b3c81", "shasum": "" }, @@ -1054,12 +1054,12 @@ "version": "v0.69", "source": { "type": "git", - "url": "https://github.com/google/google-api-php-client-services.git", + "url": "https://github.com/googleapis/google-api-php-client-services.git", "reference": "6e2507a5bb39d970ae98cc2f1421012e7b38248f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/6e2507a5bb39d970ae98cc2f1421012e7b38248f", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/6e2507a5bb39d970ae98cc2f1421012e7b38248f", "reference": "6e2507a5bb39d970ae98cc2f1421012e7b38248f", "shasum": "" }, @@ -1091,12 +1091,12 @@ "version": "v1.3.3", "source": { "type": "git", - "url": "https://github.com/google/google-auth-library-php.git", + "url": "https://github.com/googleapis/google-auth-library-php.git", "reference": "af72b3f50420c801dc35cc07b1fa429ae027b847" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/af72b3f50420c801dc35cc07b1fa429ae027b847", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/af72b3f50420c801dc35cc07b1fa429ae027b847", "reference": "af72b3f50420c801dc35cc07b1fa429ae027b847", "shasum": "" }, @@ -3091,17 +3091,11 @@ }, { "name": "twilio/sdk", - "version": "3.13.1", + "version": "dev-3.13.1-create-function-fix", "source": { "type": "git", - "url": "https://github.com/twilio/twilio-php.git", - "reference": "43bee3cc0956447efa1b83ee39b7a59b1b90df06" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/twilio/twilio-php/zipball/43bee3cc0956447efa1b83ee39b7a59b1b90df06", - "reference": "43bee3cc0956447efa1b83ee39b7a59b1b90df06", - "shasum": "" + "url": "https://github.com/hopeseekr/twilio-php", + "reference": "9408f62535209e5f2c1e88770015ee4988c14ee5" }, "require": { "php": ">=5.2.1" @@ -3116,7 +3110,6 @@ "Services_Twilio": "" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -3137,7 +3130,7 @@ "sms", "twilio" ], - "time": "2015-03-31T21:34:10+00:00" + "time": "2018-11-27T03:42:24+00:00" }, { "name": "videlalvaro/php-amqplib", @@ -7071,6 +7064,7 @@ "minds/mw3": 20, "thobbs/phpcassa": 20, "tijsverkoyen/twitteroauth": 20, + "twilio/sdk": 20, "videlalvaro/php-amqplib": 20, "vscn/cruftflake": 20, "zircote/swagger-php": 20 diff --git a/composer.phar b/composer.phar old mode 100755 new mode 100644 index 4055d874a..5316de73b Binary files a/composer.phar and b/composer.phar differ