We are using Magento ver. 2.4.3-p1
Problem:
When an admin user adds above 6 items to a cart through API for selling to a customer, It won’t complete.
It seems to be only giving a Warning, or so says my colleague who is also working on this problem.
What is certain is that the magento-backend gives a PHP “Notice”, which then makes the server return a 500 error code.
Another note would be that the items we sell are custom made uploaded as .stp files, if that has any relevance.
below are the serverlog output
Created order status: 500
{'message': "Notice: file_get_contents(): file created in the
system's temporary directory in /bitnami/magento/vendor/laminas
/laminas-http/src/PhpEnvironment/Request.php on line 96", 'trace':
'#0 [internal function]: Magento\Framework
\App\ErrorHandler->handler()n#1 /bitnami/magento/vendor/laminas
/laminas-http/src/PhpEnvironment/Request.php(96):
file_get_contents()n#2 /bitnami/magento/vendor/magento/framework
/Webapi/Rest/Request.php(140): Laminas\Http\PhpEnvironment
\Request->getContent()n#3 /bitnami/magento/vendor/magento/module-
webapi/Controller/Rest/InputParamsResolver.php(117):
Magento\Framework\Webapi\Rest\Request->getBodyParams()n#4
/bitnami/magento/vendor/magento/module-webapi/Controller
/Rest/InputParamsResolver.php(96): Magento\Webapi\Controller\Rest
\InputParamsResolver->getInputData()n#5 /bitnami/magento/vendor
/magento/framework/Interception/Interceptor.php(58): Magento\Webapi
\Controller\Rest\InputParamsResolver->resolve()n#6 /bitnami
/magento/vendor/magento/framework/Interception/Interceptor.php(138):
Magento\Webapi\Controller\Rest\InputParamsResolver
\Interceptor->___callParent()n#7 /bitnami/magento/vendor/magento
/framework/Interception/Interceptor.php(153): Magento\Webapi
\Controller\Rest\InputParamsResolver\Interceptor->Magento
\Framework\Interception\{closure}()n#8 /bitnami/magento
/generated/code/Magento/Webapi/Controller/Rest/InputParamsResolver
/Interceptor.php(23): Magento\Webapi\Controller\Rest
\InputParamsResolver\Interceptor->___callPlugins()n#9 /bitnami
/magento/vendor/magento/module-webapi/Controller
/Rest/SynchronousRequestProcessor.php(85): Magento\Webapi
\Controller\Rest\InputParamsResolver\Interceptor->resolve()n#10
/bitnami/magento/vendor/magento/module-webapi/Controller
/Rest.php(188): Magento\Webapi\Controller\Rest
\SynchronousRequestProcessor->process()n#11 /bitnami/magento
/vendor/magento/framework/Interception/Interceptor.php(58):
Magento\Webapi\Controller\Rest->dispatch()n#12 /bitnami/magento
/vendor/magento/framework/Interception/Interceptor.php(138):
Magento\Webapi\Controller\Rest\Interceptor->___callParent()n#13
/bitnami/magento/vendor/magento/framework/Interception
/Interceptor.php(153): Magento\Webapi\Controller\Rest
\Interceptor->Magento\Framework\Interception\{closure}()n#14
/bitnami/magento/generated/code/Magento/Webapi/Controller
/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest
\Interceptor->___callPlugins()n#15 /bitnami/magento/vendor/magento
/framework/App/Http.php(116): Magento\Webapi\Controller\Rest
\Interceptor->dispatch()n#16 /bitnami/magento/vendor/magento
/framework/App/Bootstrap.php(264): Magento\Framework
\App\Http->launch()n#17 /bitnami/magento/pub/index.php(29):
Magento\Framework\App\Bootstrap->run()n#18 {main}'}
It’s quite large, but from what I can work out, it looks to be our system that cannot handle the php Notice.
Since I have never touched php in my entire life, I am a little hesitant to change magnetos build in php code.
This is the code in question which returns the notice
public function getContent()
{
if (empty($this->content)) {
$requestBody = file_get_contents('php://input');
if (strlen($requestBody) > 0) {
$this->content = $requestBody;
}
}
return $this->content;
}
/**
My question then is, How do I handle/suppress a PHP notice?
Alternatively, if any debugging geniuses get something else out of this errorcode, please share, this is the only lead I have.
please also do not hesitate to ask for further information if needed.