modxcms / fred

The friendly front-end editor for visual, drag-and-drop content building in MODX CMS
https://fred.modx.com
MIT License
57 stars 25 forks source link

PHP Fatal error: Uncaught Error: Call to undefined function Moontoast\Math\bcadd() #495

Closed whatafunc closed 4 months ago

whatafunc commented 4 months ago

Hi there, it's still number one so I keep using it in other projects, and upon an element Duplication, the following URL is called in background: https://test.abc123.nl/assets/components/fred/connector.php but it errors with 500's code and the PHP8.1 logs: [03-Apr-2024 07:37:29 UTC] PHP Fatal error: Uncaught Error: Call to undefined function Moontoast\Math\bcadd() in /var/www/test.abc123.nl/html/core/components/fred/model/vendor/moontoast/math/src/Moontoast/Math/BigNumber.php:506

Stack trace:

0 /var/www/test.abc123.nl/html/core/components/fred/model/vendor/moontoast/math/src/Moontoast/Math/BigNumber.php(62): Moontoast\Math\BigNumber->setValue()

1 /var/www/test.abc123.nl/html/core/components/fred/model/vendor/ramsey/uuid/src/Converter/Number/BigNumberConverter.php(49): Moontoast\Math\BigNumber->__construct()

2 /var/www/test.abc123.nl/html/core/components/fred/model/vendor/ramsey/uuid/src/Generator/CombGenerator.php(69): Ramsey\Uuid\Converter\Number\BigNumberConverter->toHex()

3 /var/www/test.abc123.nl/html/core/components/fred/model/vendor/ramsey/uuid/src/UuidFactory.php(217): Ramsey\Uuid\Generator\CombGenerator->generate()

4 /var/www/test.abc123.nl/html/core/components/fred/model/fred/src/Utils.php(113): Ramsey\Uuid\UuidFactory->uuid4()

5 /var/www/test.abc123.nl/html/core/components/fred/model/fred/fredelement.class.php(281): Fred\Utils::uuid()

6 /var/www/test.abc123.nl/html/core/model/modx/modprocessor.class.php(1043): FredElement->save()

7 /var/www/test.abc123.nl/html/core/components/fred/processors/mgr/elements/duplicate.class.php(58): modObjectDuplicateProcessor->saveObject()

8 /var/www/test.abc123.nl/html/core/model/modx/modprocessor.class.php(185): FredElementsDuplicateProcessor->process()

9 /var/www/test.abc123.nl/html/core/model/modx/modx.class.php(1770): modProcessor->run()

10 /var/www/test.abc123.nl/html/core/model/modx/modconnectorresponse.class.php(144): modX->runProcessor()

11 /var/www/test.abc123.nl/html/core/model/modx/modconnectorrequest.class.php(86): modConnectorResponse->outputContent()

12 /var/www/test.abc123.nl/html/core/model/modx/modconnectorrequest.class.php(73): modConnectorRequest->prepareResponse()

13 /var/www/test.abc123.nl/html/assets/components/fred/connector.php(34): modConnectorRequest->handleRequest()

14 {main}

thrown in /var/www/test.abc123.nl/html/core/components/fred/model/vendor/moontoast/math/src/Moontoast/Math/BigNumber.php on line 506


So, the admin can't Duplicate any previously saved Element from the manager area ): Please advise

whatafunc commented 4 months ago

Oh... once having a closer look at the annotation " * @link http://www.php.net/bcadd" I have realised it's one of the PHP libs and tried: sudo apt install php8.1-bcmath and it seems it works!

matdave commented 4 months ago

Yeah you should see a warning when installing fred if you don't have bcmath installed. 'PHP extension "bcmath" is not loaded, but it is required by Fred.'

whatafunc commented 4 months ago

Good notification for those who is installing it. In my case it's a site copy from localhost to live Digital ocean new instance