From 0717478051f43a9f9f5cbf28e745a5e575dba8bd Mon Sep 17 00:00:00 2001 From: bancer Date: Mon, 22 Jun 2020 10:58:10 +0200 Subject: [PATCH 1/3] Add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b7eda --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/nbproject/ From a5bc39bce15ea5955c53ad8343e4c5eb37980274 Mon Sep 17 00:00:00 2001 From: bancer Date: Mon, 22 Jun 2020 11:08:44 +0200 Subject: [PATCH 2/3] Fix null pointer exception in WhoDidItBehavior::beforeSave and fix travis code sniffer config --- .travis.yml | 2 +- src/Model/Behavior/WhoDidItBehavior.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9927c0a..ca3fc8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,7 @@ install: before_script: - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi" - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi" - - sh -c "if [ '$PHPCS' = '1' ]; then composer require cakephp/cakephp-codesniffer:dev-master; fi" + - sh -c "if [ '$PHPCS' = '1' ]; then composer require cakephp/cakephp-codesniffer:3.x; fi" - sh -c "if [ '$COVERALLS' = '1' ]; then composer require --dev php-coveralls/php-coveralls; fi" - sh -c "if [ '$COVERALLS' = '1' ]; then mkdir -p build/logs; fi" diff --git a/src/Model/Behavior/WhoDidItBehavior.php b/src/Model/Behavior/WhoDidItBehavior.php index db4ceb0..1ae0099 100644 --- a/src/Model/Behavior/WhoDidItBehavior.php +++ b/src/Model/Behavior/WhoDidItBehavior.php @@ -134,6 +134,9 @@ public function beforeFind($event, $query, $options, $primary) public function beforeSave($event, $entity, $options) { $auth = Configure::read('GlobalAuth'); + if (empty($auth)) { + return; + } $id = $auth['id']; if ($entity->isNew()) { From c68c10672b4c87aabdc0b1ae5dd3045c8ae09eef Mon Sep 17 00:00:00 2001 From: bancer Date: Mon, 22 Jun 2020 11:10:49 +0200 Subject: [PATCH 3/3] Add missing line break --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 44e0a8d..0ab12fe 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ /.settings/ /vendor/ /composer.lock -/nbproject/ \ No newline at end of file +/nbproject/