OpenMage / magento-lts

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.
https://www.openmage.org
Open Software License 3.0
867 stars 436 forks source link

Deprecated functionality: nl2br(): Passing null to parameter #1 #3790

Closed ADDISON74 closed 8 months ago

ADDISON74 commented 8 months ago

OpenMage 20.3 only PHP 8.3 1 Category + 1 Configurable Product with 4 Simple Products.

This error appears in the system.log file when visiting the Configurable Product page.

2024-02-03T12:58:19+00:00 ERR (3): Deprecated functionality: nl2br(): 
Passing null to parameter #1 ($string) of type string is deprecated in 
/var/www/html/app/design/frontend/rwd/default/template/catalog/product/view/sharing.phtml on line 30

These are the lines 29 - 34

    <li>
        <?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description'))); ?>
        <a href="<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>" target="_blank" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Share on Facebook')) ?>" class="link-facebook">
            <?php echo $this->__('Share Facebook') ?>
        </a>
    </li>
sreichel commented 8 months ago

Duplicate of https://github.com/OpenMage/magento-lts/pull/3779

ADDISON74 commented 8 months ago

This issue appears when the short_description and description fields are changed in the attribute page and are no longer required to contain anything. When I filled in short_description with a character, the error no longer appears.

Most likely due to the fact that these two attributes were set up as mandatory from the very beginning, Magento Team did not take into account that they could be empty.

sreichel commented 8 months ago

Off-topic: that why it seem wrong to me to advertise php8.1+ support ... with still having a lot of issues,

... and we need unit tests ... ;)

sreichel commented 8 months ago

@ADDISON74

To reproduce

ADDISON74 commented 8 months ago

Off-topic: that why it seem wrong to me to advertise php8.1+ support ... with still having a lot of issues,

... and we need unit tests ... ;)

If we had more testers using DDEV we could carefully check the latest PHP 8.x versions for every branch . One should keep an eye on the log files and patiently load the Frontend/Backend from the sample package in all sections. I'm still using PHP 7.4 in production, which is maintained by the Debian team. The fact that it has been EOL for some time does not push me to replace it with 8.2 or 8.3 from Sury.