Skip to content

multiple API on same server #1044

Closed
Closed
@clysss

Description

@clysss

Hello,
I've 4 API xxApi.php on same server, each using a different controler.
In each, I use :
include api.include.php
everything go well until I made from :
aaApi an curl call to bbAPI
in this case there is a mismatch on the routes :
[25-Sep-2024 08:34:05 UTC] {routeList: [[{},"_list"],[{},"create"],[{},"read"],[{},"update"],[{},"delete"],[{},"increment"],[{},"_list"],[{},"read"],[{},"openapi"],[{},"ping"],[{},"createVendor"],[{},"getItem"],[{},"setItem"]],
routeId: 12,
routeInUse: [{},"setItem"]}
[25-Sep-2024 08:34:09 UTC] PHP Warning: Undefined array key 12 in ..........\phpCrudApi\go\api.include.php on line 8038
[25-Sep-2024 08:34:09 UTC] {routeList: [[{},"_list"],[{},"create"],[{},"read"],[{},"update"],[{},"delete"],[{},"increment"],[{},"_list"],[{},"read"],[{},"openapi"],[{},"ping"],[{},"setItem"]],
routeId: 12,
routeInUse: null}

if I add a debug breakpoint and wait few seconds, the reply is OK
[25-Sep-2024 08:34:20 UTC] {routeList: [[{},"_list"],[{},"create"],[{},"read"],[{},"update"],[{},"delete"],[{},"increment"],[{},"_list"],[{},"read"],[{},"openapi"],[{},"ping"],[{},"createVendor"],[{},"getItem"],[{},"setItem"]],
routeId: 12,
routeInUse: [{},"setItem"]}
[25-Sep-2024 08:34:31 UTC] {routeList: [[{},"_list"],[{},"create"],[{},"read"],[{},"update"],[{},"delete"],[{},"increment"],[{},"_list"],[{},"read"],[{},"openapi"],[{},"ping"],[{},"setItem"]],
routeId: 10,
routeInUse: [{},"setItem"]}

Finaly, I found a solution that seems really weird to me :
I made a copy of api.include.php to XXapi.include.php and each XXapi.php now include "his" XXapi.include.php
with this, everything is OK. Do you have an idea why the routelist seems shared from a 2 different API call ?
(i've test on 2 different PHP server, one on windows, one on Linux/prod environnemnt OVH)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions