View Issue Details

IDProjectCategoryView StatusLast Update
0001913OXID eShop (all versions)4.07. Source code, Testpublic2012-12-10 13:45
Reportercsimon Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Product Version4.3.2 revision 27884 
Summary0001913: "getPictureUrl" returns null if 0 is given as argument
DescriptionIf you pass a zero (0) as argument to the function, it returns 0. This is not correct, because folder "0" exists and contains thumbnails.

Additional InformationSolution:

    /**
     * Returns article picture
     *
     * @param int $iIndex picture index
     *
     * @return string
     */
    public function getPictureUrl( $iIndex = '' )
    {
        if ( $iIndex ) {

            if ( !$this->_hasGeneratedImage( $iIndex ) ) {
                $this->_generateImages( $iIndex );
            }

            $sPic = $iIndex . "/" . $this->_getPictureName( $iIndex );

            return $this->getConfig()->getPictureUrl( $sPic, $this->isAdmin() );
        }
    }

The if statement should check with the "===" operator for value "''". In addition, i would suggest to change the default value to null, instead of an empty string and check with === for null.

Btw.:

The "@param" doc comment says the parameter is of type int, but the standard value of "$iIndex" is string, as it is "''".
TagsNo tags attached.
Theme
BrowserAll
PHP Versionany
Database Versionany

Activities

Linas Kukulskis

2010-11-29 17:02

reporter   ~0003757

It's correct.
Pictures indexes are from 1 to 12, not 0.
In /0 folder are only thumbnales.