API Error (zm 1.33.6)

Forum for questions and support relating to 1.33.x development only.
Post Reply
Cramac1
Posts: 11
Joined: Wed Aug 29, 2018 11:29 am

API Error (zm 1.33.6)

Post by Cramac1 » Fri Apr 12, 2019 6:39 pm

login API

Code: Select all

	            $ch =  curl_init();
            curl_setopt( $ch, CURLOPT_URL, "http://site.ru/zm/api/host/login.json" );
			curl_setopt( $ch, CURLOPT_POST, 1);                //0 for a get request
            curl_setopt( $ch, CURLOPT_POSTFIELDS, "user=admin&pass=xxx" );
            curl_setopt( $ch, CURLOPT_COOKIEJAR,  dirname(__FILE__).'/cookie.txt' );
            $result = curl_exec( $ch );
            curl_close( $ch );
return:

Code: Select all

Fatal error: Cannot use 'object' as class name as it is reserved in /usr/share/zoneminder/www/api/lib/Cake/Core/Object.php on line 18
Call Stack
#	Time	Memory	Function	Location
1	0.0002	394928	{main}( )	.../index.php:0
2	0.3336	890672	Dispatcher->dispatch( )	.../index.php:107
3	0.4613	1059992	Dispatcher->_invoke( )	.../Dispatcher.php:167
4	0.4717	1145456	HostController->startupProcess( )	.../Dispatcher.php:189
5	0.4718	1156600	CakeEventManager->dispatch( )	.../Controller.php:677
6	0.4718	1156976	ComponentCollection->trigger( )	.../CakeEventManager.php:243
7	0.4718	1158208	CrudComponent->initialize( )	.../ObjectCollection.php:128
8	0.4719	1160456	CrudComponent->_loadListeners( )	.../CrudComponent.php:169
9	0.4719	1160832	CrudComponent->_loadListener( )	.../CrudComponent.php:728
10	0.4739	1215232	spl_autoload_call ( )	.../CrudComponent.php:752
11	0.4739	1215280	App::load( )	.../CrudComponent.php:752
12	0.4740	1217400	include( '/usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/Listener/RelatedModelsListener.php' )	.../App.php:567
13	0.4740	1217400	spl_autoload_call ( )	.../RelatedModelsListener.php:13
14	0.4740	1217440	App::load( )	.../RelatedModelsListener.php:13
15	0.4741	1219184	include( '/usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/CrudListener.php' )	.../App.php:567
16	0.4741	1219184	spl_autoload_call ( )	.../CrudListener.php:13
17	0.4741	1219224	App::load( )	.../CrudListener.php:13
18	0.4741	1221648	include( '/usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/CrudBaseObject.php' )	.../App.php:567
19	0.4742	1221648	spl_autoload_call ( )	.../CrudBaseObject.php:14
20	0.4742	1221680	App::load( )	.../CrudBaseObject.php:14
21	0.4742	1223680	include( '/usr/share/zoneminder/www/api/lib/Cake/Core/Object.php' )	.../App.php:567
22	0.4742	1223680	class_alias ( )	.../Object.php:18

( ! ) Fatal error: Uncaught Error: Class 'RelatedModelsListener' not found in /usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Component/CrudComponent.php on line 752
Call Stack
#	Time	Memory	Function	Location
1	0.0002	394928	{main}( )	.../index.php:0
2	0.3336	890672	Dispatcher->dispatch( )	.../index.php:107
3	0.4613	1059992	Dispatcher->_invoke( )	.../Dispatcher.php:167
4	0.4717	1145456	HostController->startupProcess( )	.../Dispatcher.php:189
5	0.4718	1156600	CakeEventManager->dispatch( )	.../Controller.php:677
6	0.4718	1156976	ComponentCollection->trigger( )	.../CakeEventManager.php:243
7	0.4718	1158208	CrudComponent->initialize( )	.../ObjectCollection.php:128
8	0.4719	1160456	CrudComponent->_loadListeners( )	.../CrudComponent.php:169
9	0.4719	1160832	CrudComponent->_loadListener( )	.../CrudComponent.php:728
10	0.4739	1215232	spl_autoload_call ( )	.../CrudComponent.php:752
11	0.4739	1215280	App::load( )	.../CrudComponent.php:752
12	0.4740	1217400	include( '/usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/Listener/RelatedModelsListener.php' )	.../App.php:567
13	0.4740	1217400	spl_autoload_call ( )	.../RelatedModelsListener.php:13
14	0.4740	1217440	App::load( )	.../RelatedModelsListener.php:13
15	0.4741	1219184	include( '/usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/CrudListener.php' )	.../App.php:567
16	0.4741	1219184	spl_autoload_call ( )	.../CrudListener.php:13
17	0.4741	1219224	App::load( )	.../CrudListener.php:13
18	0.4741	1221648	include( '/usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/CrudBaseObject.php' )	.../App.php:567
19	0.4742	1221648	spl_autoload_call ( )	.../CrudBaseObject.php:14
20	0.4742	1221680	App::load( )	.../CrudBaseObject.php:14
21	0.4742	1223680	include( '/usr/share/zoneminder/www/api/lib/Cake/Core/Object.php' )	.../App.php:567
22	0.4742	1223680	class_alias ( )	.../Object.php:18
( ! ) Error: Class 'RelatedModelsListener' not found in /usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Component/CrudComponent.php on line 752
Call Stack
#	Time	Memory	Function	Location
1	0.0002	394928	{main}( )	.../index.php:0
2	0.3336	890672	Dispatcher->dispatch( )	.../index.php:107
3	0.4613	1059992	Dispatcher->_invoke( )	.../Dispatcher.php:167
4	0.4717	1145456	HostController->startupProcess( )	.../Dispatcher.php:189
5	0.4718	1156600	CakeEventManager->dispatch( )	.../Controller.php:677
6	0.4718	1156976	ComponentCollection->trigger( )	.../CakeEventManager.php:243
7	0.4718	1158208	CrudComponent->initialize( )	.../ObjectCollection.php:128
8	0.4719	1160456	CrudComponent->_loadListeners( )	.../CrudComponent.php:169
9	0.4719	1160832	CrudComponent->_loadListener( )	.../CrudComponent.php:728
10	0.4739	1215232	spl_autoload_call ( )	.../CrudComponent.php:752
11	0.4739	1215280	App::load( )	.../CrudComponent.php:752
12	0.4740	1217400	include( '/usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/Listener/RelatedModelsListener.php' )	.../App.php:567
13	0.4740	1217400	spl_autoload_call ( )	.../RelatedModelsListener.php:13
14	0.4740	1217440	App::load( )	.../RelatedModelsListener.php:13
15	0.4741	1219184	include( '/usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/CrudListener.php' )	.../App.php:567
16	0.4741	1219184	spl_autoload_call ( )	.../CrudListener.php:13
17	0.4741	1219224	App::load( )	.../CrudListener.php:13
18	0.4741	1221648	include( '/usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Crud/CrudBaseObject.php' )	.../App.php:567
19	0.4742	1221648	spl_autoload_call ( )	.../CrudBaseObject.php:14
20	0.4742	1221680	App::load( )	.../CrudBaseObject.php:14
21	0.4742	1223680	include( '/usr/share/zoneminder/www/api/lib/Cake/Core/Object.php' )	.../App.php:567
22	0.4742	1223680	class_alias ( )	.../Object.php:18
23	0.4751	1232096	App::shutdown( )	.../App.php:0
24	0.4754	1232128	App::_checkFatalError( )	.../App.php:943
25	0.4754	1232792	ErrorHandler::handleError( )	.../App.php:970
26	0.4754	1232792	ErrorHandler::handleFatalError( )	.../ErrorHandler.php:212
27	0.5057	1219448	ErrorHandler::handleException( )	.../ErrorHandler.php:269
28	0.5062	1221376	ExceptionRenderer->__construct( )	.../ErrorHandler.php:126
29	0.5062	1221376	ExceptionRenderer->_getController( )	.../ExceptionRenderer.php:95
30	0.5069	1301400	CakeErrorController->startupProcess( )	.../ExceptionRenderer.php:158
31	0.5070	1312544	CakeEventManager->dispatch( )	.../Controller.php:677
32	0.5070	1312920	ComponentCollection->trigger( )	.../CakeEventManager.php:243
33	0.5071	1314152	CrudComponent->initialize( )	.../ObjectCollection.php:128
34	0.5072	1318640	CrudComponent->_loadListeners( )	.../CrudComponent.php:169
35	0.5072	1319016	CrudComponent->_loadListener( )	.../CrudComponent.php:728

rockedge
Posts: 1038
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: API Error (zm 1.33.6)

Post by rockedge » Thu Apr 18, 2019 1:52 pm

that is odd! This error was fixed some time ago with version 1.31+. It is because of changes in CRUD to deal with PHP 7.2+ and a change causes the problem. look this over and see if this is what your problem is viewtopic.php?p=105092#p105092

SpikeyGG
Posts: 46
Joined: Mon Oct 15, 2012 12:02 am

Re: API Error (zm 1.33.6)

Post by SpikeyGG » Tue Apr 23, 2019 2:15 am

When I try to navigate to the url: http://myhost/zm/api/host/getVersion.json to test the API, the I see this error message:

Code: Select all

<br />
<b>Fatal error</b>:  Uncaught Error: Call to undefined function apc_fetch() in /usr/share/zoneminder/www/api/lib/Cake/Cache/Engine/ApcEngine.php:91
Stack trace:
#0 /usr/share/zoneminder/www/api/lib/Cake/Cache/Cache.php(363): ApcEngine-&gt;read('myapp_cake_core...')
#1 /usr/share/zoneminder/www/api/lib/Cake/I18n/I18n.php(235): Cache::read('cake_dev_en-us', '_cake_core_')
#2 /usr/share/zoneminder/www/api/lib/Cake/basics.php(636): I18n::translate('Cache engine &quot;%...', NULL, 'cake_dev')
#3 /usr/share/zoneminder/www/api/lib/Cake/Cache/Cache.php(184): __d('cake_dev', 'Cache engine &quot;%...', '_cake_core_')
#4 /usr/share/zoneminder/www/api/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_')
#5 /usr/share/zoneminder/www/api/app/Config/core.php(375): Cache::config('_cake_core_', Array)
#6 /usr/share/zoneminder/www/api/lib/Cake/Core/Configure.php(72): include('/usr/share/zone...')
#7 /usr/share/zoneminder/www/api/lib/Cake/bootstrap.php(442): Configure::bootstrap(true)
#8 /usr/share/zoneminder/www/api/app/webroot/index.php(90): incl in <b>/usr/share/zoneminder/www/api/lib/Cake/Cache/Engine/ApcEngine.php</b> on line <b>91</b><br />

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests