0

I have a new installation of magento (haven't gone live yet) and just upgraded to the latest 2.4.7-p2 version. I have followed all the system requirements and upgraded from php v8.1 to 8.3 as required by the magento system requirements. When I was testing the checkout process I was presented with a server error and the following in the exception log.

I've seen other mention similar error but none with the original magento modules. Did i miss something during the upgrade where it's still using old depricated functions?

It seems this issue shouldn't be happening with an install following the published system requirements. The admin is properly reporting the v. 2.4.7-p2 which leads me to believe the upgrade is complete.

Is this a common issue with this version?

[2024年09月19日T07:06:49.757455+00:00] main.CRITICAL: Exception: Deprecated Functionality: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/html/magento2/vendor/magento/zend-db/library/Zend/Db/Adapter/Abstract.php on line 1044 in /var/www/html/magento2/vendor/magento/framework/App/ErrorHandler.php:62
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler()
#1 /var/www/html/magento2/vendor/magento/zend-db/library/Zend/Db/Adapter/Abstract.php(1044): str_replace()
#2 /var/www/html/magento2/vendor/magento/zend-db/library/Zend/Db/Adapter/Abstract.php(1024): Zend_Db_Adapter_Abstract->_quoteIdentifier()
#3 /var/www/html/magento2/vendor/magento/zend-db/library/Zend/Db/Adapter/Abstract.php(962): Zend_Db_Adapter_Abstract->_quoteIdentifierAs()
#4 /var/www/html/magento2/generated/code/Magento/Framework/DB/Adapter/Pdo/Mysql/Interceptor.php(1157): Zend_Db_Adapter_Abstract->quoteIdentifier()
#5 /var/www/html/magento2/vendor/magento/zend-db/library/Zend/Db/Adapter/Abstract.php(568): Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor->quoteIdentifier()
#6 /var/www/html/magento2/generated/code/Magento/Framework/DB/Adapter/Pdo/Mysql/Interceptor.php(1058): Zend_Db_Adapter_Abstract->insert()
#7 /var/www/html/magento2/vendor/magento/module-sales-sequence/Model/Sequence.php(85): Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor->insert()
#8 /var/www/html/magento2/vendor/magento/module-quote/Model/ResourceModel/Quote.php(177): Magento\SalesSequence\Model\Sequence->getNextValue()
#9 /var/www/html/magento2/vendor/magento/module-quote/Model/Quote.php(2258): Magento\Quote\Model\ResourceModel\Quote->getReservedOrderId()
#10 /var/www/html/magento2/generated/code/Magento/Quote/Model/Quote/Interceptor.php(824): Magento\Quote\Model\Quote->reserveOrderId()
#11 /var/www/html/magento2/vendor/magento/module-quote/Model/QuoteManagement.php(556): Magento\Quote\Model\Quote\Interceptor->reserveOrderId()
#12 /var/www/html/magento2/vendor/magento/module-quote/Model/QuoteManagement.php(501): Magento\Quote\Model\QuoteManagement->submitQuote()
#13 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Quote\Model\QuoteManagement->submit()
#14 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Quote\Model\QuoteManagement\Interceptor->___callParent()
#15 /var/www/html/magento2/vendor/magento/module-sales-rule/Plugin/CouponUsagesIncrement.php(54): Magento\Quote\Model\QuoteManagement\Interceptor->Magento\Framework\Interception\{closure}()
#16 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(135): Magento\SalesRule\Plugin\CouponUsagesIncrement->aroundSubmit()
#17 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Quote\Model\QuoteManagement\Interceptor->Magento\Framework\Interception\{closure}()
#18 /var/www/html/magento2/generated/code/Magento/Quote/Model/QuoteManagement/Interceptor.php(68): Magento\Quote\Model\QuoteManagement\Interceptor->___callPlugins()
#19 /var/www/html/magento2/vendor/magento/module-quote/Model/QuoteManagement.php(459): Magento\Quote\Model\QuoteManagement\Interceptor->submit()
#20 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Quote\Model\QuoteManagement->placeOrder()
#21 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Quote\Model\QuoteManagement\Interceptor->___callParent()
#22 /var/www/html/magento2/vendor/paypal/module-braintree-core/Plugin/OrderCancellation.php(64): Magento\Quote\Model\QuoteManagement\Interceptor->Magento\Framework\Interception\{closure}()
#23 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(135): PayPal\Braintree\Plugin\OrderCancellation->aroundPlaceOrder()
#24 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Quote\Model\QuoteManagement\Interceptor->Magento\Framework\Interception\{closure}()
#25 /var/www/html/magento2/generated/code/Magento/Quote/Model/QuoteManagement/Interceptor.php(50): Magento\Quote\Model\QuoteManagement\Interceptor->___callPlugins()
#26 /var/www/html/magento2/vendor/magento/module-quote/Model/GuestCart/GuestCartManagement.php(87): Magento\Quote\Model\QuoteManagement\Interceptor->placeOrder()
#27 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Quote\Model\GuestCart\GuestCartManagement->placeOrder()
#28 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Quote\Model\GuestCart\GuestCartManagement\Interceptor->___callParent()
#29 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Quote\Model\GuestCart\GuestCartManagement\Interceptor->Magento\Framework\Interception\{closure}()
#30 /var/www/html/magento2/generated/code/Magento/Quote/Model/GuestCart/GuestCartManagement/Interceptor.php(41): Magento\Quote\Model\GuestCart\GuestCartManagement\Interceptor->___callPlugins()
#31 /var/www/html/magento2/vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php(142): Magento\Quote\Model\GuestCart\GuestCartManagement\Interceptor->placeOrder()
#32 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Checkout\Model\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder()
#33 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->___callParent()
#34 /var/www/html/magento2/vendor/cybersource/module-3dsecure/Plugin/Checkout/Model/GuestPaymentInformationManagementInterfacePlugin.php(34): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->Magento\Framework\Interception\{closure}()
#35 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(135): CyberSource\ThreeDSecure\Plugin\Checkout\Model\GuestPaymentInformationManagementInterfacePlugin->aroundSavePaymentInformationAndPlaceOrder()
#36 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->Magento\Framework\Interception\{closure}()
#37 /var/www/html/magento2/generated/code/Magento/Checkout/Model/GuestPaymentInformationManagement/Interceptor.php(23): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->___callPlugins()
#38 [internal function]: Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->savePaymentInformationAndPlaceOrder()
#39 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array()
#40 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(201): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process()
#41 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch()
#42 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent()
#43 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}()
#44 /var/www/html/magento2/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins()
#45 /var/www/html/magento2/vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch()
#46 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->launch()
#47 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->___callParent()
#48 /var/www/html/magento2/vendor/magento/module-application-performance-monitor/Plugin/ApplicationPerformanceMonitor.php(38): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#49 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(135): Magento\ApplicationPerformanceMonitor\Plugin\ApplicationPerformanceMonitor->aroundLaunch()
#50 /var/www/html/magento2/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#51 /var/www/html/magento2/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor->___callPlugins()
#52 /var/www/html/magento2/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#53 /var/www/html/magento2/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
#54 {main} {"exception":"[object] (Exception(code: 0): Deprecated Functionality: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/html/magento2/vendor/magento/zend-db/library/Zend/Db/Adapter/Abstract.php on line 1044 at /var/www/html/magento2/vendor/magento/framework/App/ErrorHandler.php:62)"} []

I also don't understand why these packages won't update with composer update or composer install.

 $ composer outdated
Color legend:
- patch or minor release available - update recommended
- major release available - update possible
Direct dependencies required in composer.json:
allure-framework/allure-phpunit 2.1.0 3.0.1 Allure PHPUnit integration
dealerdirect/phpcodesniffer-composer-installer 0.7.2 1.0.0 PHP_CodeSniffer Standards Composer Installer Plugin
magento/magento2-functional-testing-framework 4.6.1 4.8.2 Magento2 Functional Testing Framework
phpunit/phpunit 9.6.21 11.3.6 The PHP Unit Testing framework.
sebastian/phpcpd 6.0.3 6.0.3 Copy/Paste Detector (CPD) for PHP code.
Package sebastian/phpcpd is abandoned, you should avoid using it. No replacement was suggested.
symfony/finder 5.4.43 7.1.4 Finds files and directories via an intuitive fluent interface
Transitive dependencies not required in composer.json:
bacon/bacon-qr-code 2.0.8 3.0.0 BaconQrCode is a QR code generator for PHP.
braintree/braintree_php 6.13.0 6.19.0 Braintree PHP Client Library
brick/varexporter 0.4.0 0.5.0 A powerful alternative to var_export(), which can export closures and objects without __set_state()
codeception/module-webdriver 3.2.2 4.0.2 WebDriver module for Codeception
colinmollenhour/php-redis-session-abstract 1.5.5 2.0.0 A Redis-based session handler with optimistic locking
composer/composer 2.7.7 2.7.9 Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have t...
elasticsearch/elasticsearch 7.17.2 8.15.0 PHP Client for Elasticsearch
endroid/qr-code 4.8.5 5.1.0 Endroid QR Code
ezimuel/guzzlestreams 3.1.0 4.0.0 Fork of guzzle/streams (abandoned) to be used with elasticsearch-php
justinrainbow/json-schema 5.3.0 6.0.0 A library to validate a json schema.
laminas/laminas-crypt 3.12.0 4.0.0 Strong cryptography tools and password hashing
Package laminas/laminas-crypt is abandoned, you should avoid using it. No replacement was suggested.
laminas/laminas-mail 2.25.1 2.25.1 Provides generalized functionality to compose and send both text and MIME-compliant multipart e-ma...
Package laminas/laminas-mail is abandoned, you should avoid using it. Use symfony/mailer instead.
laminas/laminas-servicemanager 3.22.1 4.2.0 Factory-Driven Dependency Injection Container
lcobucci/jwt 4.3.0 5.3.0 A simple library to work with JSON Web Token and JSON Web Signature
league/flysystem 2.5.0 3.28.0 File storage abstraction for PHP
league/flysystem-aws-s3-v3 2.5.0 3.28.0 AWS S3 filesystem adapter for Flysystem.
monolog/monolog 2.9.3 3.7.0 Sends your logs to files, sockets, inboxes, databases and various web services
nikic/php-parser 4.19.2 5.2.0 A PHP parser written in PHP
php-amqplib/php-amqplib 3.2.0 3.7.1 Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol....
phpunit/php-code-coverage 9.2.32 11.0.6 Library that provides collection, processing, and rendering functionality for PHP code coverage in...
phpunit/php-file-iterator 3.0.6 5.1.0 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker 3.1.1 5.0.1 Invoke callables with a timeout
phpunit/php-text-template 2.0.4 4.0.1 Simple template engine.
phpunit/php-timer 5.0.3 7.0.1 Utility class for timing
psr/container 1.1.2 2.0.2 Common Container Interface (PHP FIG PSR-11)
react/promise 2.11.0 3.2.0 A lightweight implementation of CommonJS Promises/A for PHP
sebastian/cli-parser 1.0.2 3.0.2 Library for parsing CLI options
sebastian/code-unit 1.0.8 3.0.1 Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 2.0.3 4.0.1 Looks up which function or method a line of code belongs to
sebastian/comparator 4.0.8 6.1.0 Provides the functionality to compare PHP values for equality
sebastian/complexity 2.0.3 4.0.1 Library for calculating the complexity of PHP code units
sebastian/diff 4.0.6 6.0.2 Diff implementation
sebastian/environment 5.1.5 7.2.0 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 4.0.6 6.1.3 Provides the functionality to export PHP variables for visualization
sebastian/global-state 5.0.7 7.0.2 Snapshotting of global state
sebastian/lines-of-code 1.0.4 3.0.1 Library for counting the lines of code in PHP source code
sebastian/object-enumerator 4.0.4 6.0.1 Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector 2.0.4 4.0.1 Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context 4.0.5 6.0.2 Provides functionality to recursively process PHP variables
sebastian/type 3.2.1 5.1.0 Collection of value objects that represent the types of the PHP type system
sebastian/version 3.0.2 5.0.1 Library that helps with managing the version number of Git-hosted PHP projects
symfony/config 6.4.8 7.1.1 Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console 6.4.11 7.1.4 Eases the creation of beautiful and testable command line interfaces
symfony/dependency-injection 6.4.11 7.1.4 Allows you to standardize and centralize the way objects are constructed in your application
symfony/dotenv 6.4.10 7.1.3 Registers environment variables from a .env file
symfony/http-foundation 6.4.10 7.1.3 Defines an object-oriented layer for the HTTP specification
symfony/intl 6.4.8 7.1.1 Provides access to the localization data of the ICU library
symfony/mime 6.4.11 7.1.4 Allows manipulating MIME messages
symfony/process 6.4.8 7.1.3 Executes commands in sub-processes
symfony/string 6.4.11 7.1.4 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme cl...
web-token/jwt-framework 3.4.6 4.0.1 JSON Object Signing and Encryption library for PHP and Symfony Bundle.
wikimedia/less.php 3.2.1 5.1.1 PHP port of the LESS processor
asked Sep 17, 2024 at 5:05
1
  • it seems this issue is a result of using zend instead of laminas. I'm unsure of how to remoze the zend modules and repplace with the proper ones. I'm still unsure how the zend modules are even in here being that they were decricated in magento 2.4.3 and installd 2.4.6 fresh. I'm so confused when it comes to using composer. Commented Sep 19, 2024 at 9:56

4 Answers 4

0

This issue occurs when str_replace is being passed a null value in your code. To identify which module is causing this, you can use the following command to search for the str_replace function in your custom module and Theme:

bash
grep -r "str_replace"

Run this in command prompt in your app/code or app/design directory, and then review the file where it's used. Ensure that you check whether the variable being passed has a value before applying the str_replace function. If necessary, add a validation check for the variable before using str_replace.

answered Sep 17, 2024 at 10:37
5
  • Based on the full error message, it seems that the issue is in one of the frameowrk files from magento. Why would this be an issue if I' using the recommended versions of all software as published by magneto? Commented Sep 18, 2024 at 4:10
  • As previously mentioned, the issue arises because you have an upgraded version of Magento, but some modules are still passing null values, which is causing the problem. For example, if you run Magento with the default settings and modules, you won't encounter any issues. Commented Sep 18, 2024 at 7:28
  • how can I tell what module is throwing the error? It seems to me that the error is the framework of megento and not in any installed module as mentioned here: [2024年09月16日T12:22:44.976431+00:00] main.CRITICAL: Exception: Deprecated Functionality: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/html/magento2/vendor/magento/zend-db/library/Zend/Db/Adapter/Abstract.php on line 1044 in /var/www/html/magento2/vendor/magento/framework/App/ErrorHandler.php:62 I haven't done any heavy modifications. just a theme and a payment option. Commented Sep 18, 2024 at 17:56
  • You just need to check in you custom module and theme for str_replace which was causing the issue. Commented Sep 19, 2024 at 5:24
  • the str functions are appearing in modules that aren't customer. it'spart of the zend framework which was supposed to be all moved to laminas by now. I'm stll really puzzled as to why this is happening. I shouldn't have to edit anything if everything is up to date, right? Commented Sep 25, 2024 at 7:24
0

If you are in developer mode, you should be able to see the full stack trace on the var/log/debug.log file.

If you don't find it there, you might resolve to go into the vendor/magento/framework/App/ErrorHandler.php and on the beginning of the function (line function 47) add a debug_print_backtrace(); to get the full stack trace on the error. This way you can see where this is been triggered and reach to the correct location to fix.

Make sure you have the error reporting set correctly on your php configuration so you can see the error on the browser.

answered Sep 18, 2024 at 18:50
8
  • Here is the entry from the debug.log file which is where I got the error from the OP. It seems the issue is in Abstract.php which isn't related to any plgin that I have put in as far as I can tell. I have updated the OP with the full debug.log entry Commented Sep 19, 2024 at 7:11
  • I have found that I have a lot of dependancies that are out of date with 'composer outdated'. I don't understand how this happneed as my magento install is only 2 months old. When I try to update with: composer install they don't update. Please advise Commented Sep 19, 2024 at 7:59
  • compose install will use your current composer.lock entries (as expected). Using composer update should bring the packages to a newer version inside your dependencies restrictions. Commented Sep 19, 2024 at 12:26
  • In this case the code is magento core but is loaded from the generated section. Have you tried to remove that directory contents completely and run the mangeot setup:di:compile again? Commented Sep 19, 2024 at 12:27
  • does composer update edit the composer.json file to allow newe versions of listed packaes? please elaborate on composer install, vs composer update. Commented Sep 19, 2024 at 18:25
0

it seems like that module PayPal\Braintree\Plugin may be causing this issue, check the version in composer.json of module.

In "require" check if "php" has ur version used.

answered Sep 19, 2024 at 16:20
2
  • braintree isn't mentioned in the composer.json file at all. Commented Sep 19, 2024 at 18:01
  • I have removed the Braintree modules. Commented Oct 29, 2024 at 19:47
0

I ended up reinstalling the OS from scratch and therefore installing Magento from scratch. The best thing that I can figure out about my issues in my original install is that there was a dependancy version issue that was pulling some old code that included the STR_replace function. Quite the frustrating situation. Lots of time was wasted.

In my new install, everything is working fine.

answered Nov 13, 2024 at 6:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.