View Issue Details

IDProjectCategoryView StatusLast Update
0006179module PayPal Plusmodule PayPal Plus - subpublic2016-07-20 14:30
Reporterd3 Assigned To 
PrioritynormalSeverityminorReproducibilitysometimes
Status resolvedResolutionfixed 
Product Version1.0.1 
Summary0006179: oxpsPayPalPlusOxViewConfig use parent attribute
DescriptionClass oxpsPayPalPlusOxViewConfig extends oxViewConf.
There is already a "protected $_oShop = null;" in oxViewConf declared.

This causes an exception in the frontend "Function 'getPayPalPlusConfig' does not exist or is not accessible! (oxShop)".


best reagards
KH
Steps To ReproduceSolution:
get a separated name:

    /**
     * OXID eShop methods wrapper instance.
     *
     * @var null|oxpsPayPalPlusShop
     */
    protected $_oPaypalShop = null;


    /**
     * Get OXID eShop wrapper.
     *
     * @return oxpsPayPalPlusShop
     */
    public function getPayPalPlusShop()
    {
        if (is_null($this->_oPaypalShop)) {
            $this->_oPaypalShop = oxpsPayPalPlusShop::getShop();
        }

        return $this->_oPaypalShop;
    }
TagsException, oxViewConf, Paypal Plus

Activities

d3

2015-06-29 17:03

reporter   ~0011071

Module version 1.0.1
Shop version CE 4.7.5

d3

2015-07-06 14:20

reporter   ~0011085

if you use this code snippet:
/** @var $oViewConfig oxViewconfig * */
$oViewConfig = oxNew('oxViewconfig');
$oShop = $oViewConfig->getShop();

Which object is loaded in $oShop?
Which object should be in $oShop?

best regards
Kristian

QA

2015-07-22 18:54

administrator   ~0011128

Tested with current Version 1.0.5 and current shop version. Issue is not reproducible.

d3

2015-07-23 10:34

reporter   ~0011129

Test it with this code:
/** @var $oViewConfig oxpsPayPalPlusOxViewConfig * */
$oViewConfig = oxNew('oxViewconfig');
$oViewConfig->setViewShop(oxnew('oxshop'), array());

$oShop = $oViewConfig->getShop();
$oShop->getPayPalPlusConfig(); // Exception

KH

101-oxid-bugs

2016-01-22 23:38

reporter   ~0011445

The way I see it the problem shows up as soon as a SECOND module is using the protected class variable $_oShop.

Due to this we have the company coding rule:

>
In cases a class is extended from an OXID class (it appears in the extend section of the metadata.php) - AND ONLY THEN - every class variable needs the prefix em, IF the function is protected or public.

In cases a class is extended from an OXID class, additionally the technical name of the module/extension has to be part of the name.
<

The individual prefix in combination with the name of the module (PayPal or better PayPalPlus as suggested from d3) prevents the conflict.

To only call it $_oPayPalShop is still not save, because there could be a conflict with another third-party PayPal extension (if they don't add their two-char company ident either).

So the save name for OXID would be: $_oOxPayPalPlusShop or similar

Alpha-Sys

2016-04-05 16:40

reporter   ~0011517

The bug still exists in paypal plus module version 2.0.1.
I had the same exception in a live shop (oxid version 4.9.7 with several modules). I used the workaround/solution mentioned above.
When there will be a bugfix in the paypal plus module?

benjamin.joerger

2016-07-20 14:30

reporter   ~0011707

PayPal Plus version 2.0.3 was released which solves the issue
http://exchange.oxid-esales.com/de/en/Bestellprozess-und-Versand/Bezahlung/PayPal-PLUS-2-0-3-Stable-EE-PE-4-9-x-5-2-x.html