(Solved)API not working with PHP 7.2 and Bionic 18.04

Forum for questions and support relating to the 1.31.x releases only.
rockedge
Posts: 1197
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: (Solved)API not working with PHP 7.2 and Bionic 18.04

Post by rockedge »

I ran it again and using Bionic 18.04 PHP 7.2.3 ZM 1.30.4 swapped in the cakephp 2.10.8 /lib folder and replaced Crud with version 3.1.0 then changed line 15 and the name of the abstract class and the API works.
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: (Solved)API not working with PHP 7.2 and Bionic 18.04

Post by knight-of-ni »

Not a problem. I'm just trying to understand this as best I can... the best way to fix this is file a bug report with the Crud project, but that's always tough when you don't know enough about how things work to describe the problem well enough and then intelligently answer questions.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
bbunge
Posts: 2956
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: (Solved)API not working with PHP 7.2 and Bionic 18.04

Post by bbunge »

knnniggett wrote: Thu Mar 22, 2018 9:17 pm Can you guys check something for me....

I had a moment to install 18.04, and I can get the api working by changing just the abstract class to mention CakeObject, rather than Object.
The api appears to still work if I skip adding App::uses('AppController', 'Controller');

Can you confirm this?
Went back to the original api and made the change to CakeObject. the api did not work with the original cakephp and crud.
rockedge
Posts: 1197
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: (Solved)API not working with PHP 7.2 and Bionic 18.04

Post by rockedge »

if you use the stock API and that version of cakephp, 2.8 I think, there is no change in /usr/share/zoneminder/www/api/lib/Cake/Core. The version 2.10.8 includes the file /usr/share/zoneminder/www/api/lib/Cake/Core/CakeObject.php. This is really Object.php renamed and Object.php is rewritten to only refer to CakeObject.php. When we rename the Class Object to CakeObject in /usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/CrudBaseObject.php the code is now pointing to the CakeObject.php.

One can use the stock cakephp I think by renaming /usr/share/zoneminder/www/api/lib/Cake/Core/Object.php. to CakeObject.php then change the lines in Object.php to do the same function as the new version in cakephp 2.10.8 and do the change to /usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/CrudBaseObject.php...I think it may work but is more involved then overwriting the /lib/Cake folder with v2.10.8 and throw in the newer version 3.1.0 of Crud and modify one line....
rockedge
Posts: 1197
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: (Solved)API not working with PHP 7.2 and Bionic 18.04

Post by rockedge »

the problem appears to be that in /usr/share/zoneminder/www/api/lib/Cake/Core/Object.php in version cakephp 2.10.8
this is the new code

Code: Select all

App::uses('CakeObject', 'Core');
class_alias('CakeObject', 'Object');
and one would think that the Crud reference to "Object" would then be referred to CakeObject.php... but as we can tell....that is not true because we need to make the change to the line of code in Crud.

It would seem the coder's from Crud should make the change and release a version of Crud 3.1.1 as a favor maybe
User avatar
iconnor
Posts: 3263
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: (Solved)API not working with PHP 7.2 and Bionic 18.04

Post by iconnor »

I think we are going to have to send a PR to the Crud guys. Others could benefit from this work too.
User avatar
knight-of-ni
Posts: 2406
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: (Solved)API not working with PHP 7.2 and Bionic 18.04

Post by knight-of-ni »

Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
bfl
Posts: 7
Joined: Mon Jul 10, 2017 8:42 am
Location: ru_RU, MSK, UTC+3

Re: (Solved)API not working with PHP 7.2 and Bionic 18.04

Post by bfl »

knight-of-ni wrote: Fri Mar 23, 2018 9:44 pm PR created:
https://github.com/FriendsOfCake/crud/issues/581
Wow, Thank you! Now api works with php7.2!
denvid
Posts: 14
Joined: Thu Jan 10, 2019 10:27 am

Re: (Solved)API not working with PHP 7.2 and Bionic 18.04

Post by denvid »

Hi, I have also the problem that I´ve got an error message from CakePHP 2.10.8.:

Your tmp directory is NOT writable.

I´m running Zoneminder 1.32.3 on Ubuntu 18.04. Zoneminder is working well in the browser window, but I don´t have any acces from zmNinja. All symbolic links from /user/share/zoneminder... and deeper are pointing to /tmp and set to www-data:www-data 777.

Any idea what´s going wrong?
Locked