mageplus / mageplus

A community owned and driven, enterprise fork of Magento Community Edition 1.7.0
Other
366 stars 84 forks source link

List of minor problems found by static analysis #148

Open rlerdorf opened 11 years ago

rlerdorf commented 11 years ago

As per https://github.com/mageplus/mageplus/pull/147 here is the raw list of potential issues. I have tried to filter out 3rd-party stuff though.

--------------------------------
File       : lib/Mage/Connect/Loader/Ftp.php:98
Reason     : UseUndeclaredVariable
Snippet    : $out
Line       : return $out;

--------------------------------
File       : lib/Mage/Connect/Packager.php:293
Reason     : UseUndeclaredVariable
Snippet    : $cachObj
Line       : $p = $cachObj->getPackageObject($chanName, $package);

--------------------------------
File       : lib/Varien/Db/Tree.php:441
Reason     : UseUndeclaredVariable
Snippet    : $pID
Line       : } elseif ($aId != 0 && $pID == $eInfo[$this->_pid]) { // if we have after ID

--------------------------------
File       : lib/Varien/File/Uploader/Image.php:223
Reason     : UseUndeclaredVariable
Snippet    : $visibilityPercent
Line       : $this->uploader->image_text_percent = $visibilityPercent;

--------------------------------
File       : lib/Varien/File/Uploader/Image.php:40
Reason     : UnknownObjectMethod
Snippet    : $this->newUploader($file)
Line       : $this->newUploader($file);

--------------------------------
File       : downloader/lib/Mage/Connect/Converter.php:317
Reason     : UseUndeclaredVariable
Snippet    : $targetArchive
Line       : if(@file_exists($targetArchive)) {

--------------------------------
File       : downloader/lib/Mage/DB/Mysqli.php:474
Reason     : UseUndeclaredVariable
Snippet    : $values
Line       : foreach ($values as $id) {

--------------------------------
File       : downloader/lib/Mage/System/Ftp.php:245
Reason     : UseUndeclaredVariable
Snippet    : $localFile
Line       : throw new Exception("Local file doesn't exist: {$localFile}");

--------------------------------
File       : lib/Mage/HTTP/Client/Curl.php:480
Reason     : UseUndeclaredVariable
Snippet    : $arr
Line       : curl_setopt_array($this->_ch, $arr);

--------------------------------
File       : lib/Mage/System/Ftp.php:245
Reason     : UseUndeclaredVariable
Snippet    : $localFile
Line       : throw new Exception("Local file doesn't exist: {$localFile}");

--------------------------------
File       : app/code/core/Mage/Customer/Model/Convert/Adapter/Customer.php:729
Reason     : UseUndeclaredVariable
Snippet    : $args
Line       : $row = $args;

--------------------------------
File       : lib/Mage/DB/Mysqli.php:474
Reason     : UseUndeclaredVariable
Snippet    : $values
Line       : foreach ($values as $id) {

--------------------------------
File       : app/code/core/Mage/Customer/Model/Convert/Parser/Customer.php:470
Reason     : UseUndeclaredVariable
Snippet    : $storeId
Line       : 'store_view'=>$this->getStoreCode($this->getVar('store') ? $this->getVar('store') : $storeId),

--------------------------------
File       : app/code/core/Mage/Customer/Model/Convert/Parser/Customer.php:480
Reason     : UseUndeclaredVariable
Snippet    : $systemFields
Line       : if (in_array($field, $systemFields)) {

--------------------------------
File       : app/code/core/Mage/Dataflow/Model/Convert/Profile/Abstract.php:116
Reason     : UseUndeclaredVariable
Snippet    : $profile
Line       : $action = $profile->addAction();

--------------------------------
File       : app/code/core/Mage/Core/Model/Url/Rewrite.php:175
Reason     : UseUndeclaredVariable
Snippet    : $k
Line       : if (!is_numeric($k)) {

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:128
Reason     : UseUndeclaredVariable
Snippet    : $order
Line       : ->setOrder($order)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:129
Reason     : UseUndeclaredVariable
Snippet    : $items
Line       : ->setItems($items)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:137
Reason     : UseUndeclaredVariable
Snippet    : $order
Line       : ->setOrder($order)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:138
Reason     : UseUndeclaredVariable
Snippet    : $items
Line       : ->setItems($items)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:146
Reason     : UseUndeclaredVariable
Snippet    : $order
Line       : ->setOrder($order)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:147
Reason     : UseUndeclaredVariable
Snippet    : $items
Line       : ->setItems($items)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:165
Reason     : UseUndeclaredVariable
Snippet    : $order
Line       : ->setOrder($order)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:166
Reason     : UseUndeclaredVariable
Snippet    : $items
Line       : ->setItems($items)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:176
Reason     : UseUndeclaredVariable
Snippet    : $order
Line       : ->setOrder($order)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:177
Reason     : UseUndeclaredVariable
Snippet    : $items
Line       : ->setItems($items)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:185
Reason     : UseUndeclaredVariable
Snippet    : $order
Line       : ->setOrder($order)

--------------------------------
File       : app/code/core/Mage/GoogleCheckout/Model/Api.php:186
Reason     : UseUndeclaredVariable
Snippet    : $items
Line       : ->setItems($items)

--------------------------------
File       : app/code/core/Mage/Adminhtml/Controller/Sales/Creditmemo.php:109
Reason     : UseUndeclaredVariable
Snippet    : $pdf
Line       : if (!isset($pdf)){

--------------------------------
File       : app/code/core/Mage/Adminhtml/Controller/Sales/Creditmemo.php:113
Reason     : UseUndeclaredVariable
Snippet    : $pdf
Line       : $pdf->pages = array_merge ($pdf->pages, $pages->pages);

--------------------------------
File       : app/code/core/Mage/Adminhtml/Controller/Sales/Shipment.php:88
Reason     : UseUndeclaredVariable
Snippet    : $pdf
Line       : if (!isset($pdf)){

--------------------------------
File       : app/code/core/Mage/Adminhtml/Controller/Sales/Shipment.php:92
Reason     : UseUndeclaredVariable
Snippet    : $pdf
Line       : $pdf->pages = array_merge ($pdf->pages, $pages->pages);

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Widget/Grid/Block.php:39
Reason     : UseUndeclaredVariable
Snippet    : $block
Line       : $block->setPageObject($row);

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Widget/Grid/Block.php:40
Reason     : UseUndeclaredVariable
Snippet    : $block
Line       : echo $block->toHtml();

--------------------------------
File       : app/code/core/Mage/Catalog/Model/Resource/Abstract.php:368
Reason     : UseUndeclaredVariable
Snippet    : $idField
Line       : $idField            => (int)$object->getId(),

--------------------------------
File       : app/code/core/Mage/Catalog/Model/Resource/Abstract.php:480
Reason     : UnknownObjectMethod
Snippet    : $this->getUseDataSharing()
Line       : if ($this->getUseDataSharing()) {

--------------------------------
File       : app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php:136
Reason     : UseUndeclaredVariable
Snippet    : $pdf
Line       : if (!isset($pdf)){

--------------------------------
File       : app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php:140
Reason     : UseUndeclaredVariable
Snippet    : $pdf
Line       : $pdf->pages = array_merge ($pdf->pages, $pages->pages);

--------------------------------
File       : app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php:274
Reason     : UseUndeclaredVariable
Snippet    : $shippingResponse
Line       : if (isset($shippingResponse) && $shippingResponse->hasErrors()) {

--------------------------------
File       : app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php:274
Reason     : UseUndeclaredVariable
Snippet    : $shippingResponse
Line       : if (isset($shippingResponse) && $shippingResponse->hasErrors()) {

--------------------------------
File       : app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php:160
Reason     : UseUndeclaredVariable
Snippet    : $data
Line       : Mage::getSingleton('adminhtml/session')->setFormData($data);

--------------------------------
File       : app/code/core/Mage/Adminhtml/controllers/System/Email/TemplateController.php:162
Reason     : UseUndeclaredVariable
Snippet    : $id
Line       : $this->_redirect('*/*/edit', array('id' => $id));

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Report/Product/Grid.php:59
Reason     : TooFewArgument
Snippet    : $totalObj->countTotals($this)
Line       : $this->setTotals($totalObj->countTotals($this));

--------------------------------
File       : app/code/core/Mage/Api/Model/Resource/Roles.php:80
Reason     : TooFewArgument
Snippet    : $this->load($role->getPid())
Line       : $row = $this->load($role->getPid());

--------------------------------
File       : app/code/core/Mage/Catalog/Model/Config.php:175
Reason     : TooFewArgument
Snippet    : $this->getAttributeSetId($attributeSetId)
Line       : $attributeSetId = $this->getAttributeSetId($attributeSetId);

--------------------------------
File       : app/code/core/Mage/Catalog/Model/Config.php:189
Reason     : TooFewArgument
Snippet    : $this->getAttributeSetId($attributeSetId)
Line       : $attributeSetId = $this->getAttributeSetId($attributeSetId);

--------------------------------
File       : app/code/core/Mage/Core/Block/Template.php:174
Reason     : TooManyArgument
Snippet    : Mage::log('Not valid script path:' . $dir, 2, null, null, true)
Line       : Mage::log('Not valid script path:' . $dir, Zend_Log::CRIT, null, null, true);

--------------------------------
File       : app/code/core/Mage/Core/Block/Template.php:243
Reason     : TooManyArgument
Snippet    : Mage::log('Not valid template file:' . $fileName, 2, null, null, true)
Line       : Mage::log('Not valid template file:'.$fileName, Zend_Log::CRIT, null, null, true);

--------------------------------
File       : app/code/core/Mage/Core/Model/Email/Template.php:442
Reason     : TooManyArgument
Snippet    : $this->getProcessedTemplate($variables, true)
Line       : $text = $this->getProcessedTemplate($variables, true);

--------------------------------
File       : app/code/core/Mage/Core/Model/Url.php:991
Reason     : TooManyArgument
Snippet    : $this->setQueryParams($query, !empty($routeParams['_current']))
Line       : $this->setQueryParams($query, !empty($routeParams['_current']));

--------------------------------
File       : app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php:317
Reason     : TooManyArgument
Snippet    : $this->addFieldToSelect($value, is_string($key) ? $key, $key : null, false)
Line       : $this->addFieldToSelect(

--------------------------------
File       : app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php:521
Reason     : TooManyArgument
Snippet    : $this->_fetchAll($query, $this->_bindParams)
Line       : $this->_data = $this->_fetchAll($query, $this->_bindParams);

--------------------------------
File       : app/code/core/Mage/Reports/Model/Resource/Order/Collection.php:81
Reason     : TooManyArgument
Snippet    : $this->_prepareSummaryAggregated($range, $customStart, $customEnd, $isFilter)
Line       : $this->_prepareSummaryAggregated($range, $customStart, $customEnd, $isFilter);

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Backup/Grid.php:41
Reason     : TooManyArgument
Snippet    : $this->setDefaultSort('time', 'desc')
Line       : $this->setDefaultSort('time', 'desc');

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Cart.php:41
Reason     : TooManyArgument
Snippet    : $this->setDefaultSort('added_at', 'desc')
Line       : $this->setDefaultSort('added_at', 'desc');

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php:84
Reason     : TooManyArgument
Snippet    : $this->addColumn('is_searchable', array('header' => Mage::helper('catalog')->__('Searchable'), 'sortable' => true, 'index' => 'is_searchable', 'type' => 'options', 'options' => array('1' => Mage::helper('catalog')->__('Yes'), '0' => Mage::helper('catalog')->__('No')), 'align' => 'center'), 'is_user_defined')
Line       : $this->addColumn('is_searchable', array(

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Orders.php:41
Reason     : TooManyArgument
Snippet    : $this->setDefaultSort('created_at', 'desc')
Line       : $this->setDefaultSort('created_at', 'desc');

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Tag/Grid/All.php:40
Reason     : TooManyArgument
Snippet    : $this->setDefaultSort('tag_id', 'desc')
Line       : $this->setDefaultSort('tag_id', 'desc');

--------------------------------
File       : app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php:520
Reason     : TooManyArgument
Snippet    : $this->_addUrlRewrite($this->_urlRewriteCategory)
Line       : $this->_addUrlRewrite($this->_urlRewriteCategory);

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php:46
Reason     : TooManyArgument
Snippet    : $this->setDefaultSort('subscriber_id', 'desc')
Line       : $this->setDefaultSort('subscriber_id', 'desc');

--------------------------------
File       : app/code/core/Mage/Catalog/Model/Api2/Product/Website/Rest.php:106
Reason     : TooManyArgument
Snippet    : $this->_getLocation($website, $product)
Line       : return $this->_getLocation($website, $product);

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Orders.php:41
Reason     : TooManyArgument
Snippet    : $this->setDefaultSort('created_at', 'desc')
Line       : $this->setDefaultSort('created_at', 'desc');

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/Notification/Grid.php:42
Reason     : TooManyArgument
Snippet    : $this->setDefaultSort('date_added', 'desc')
Line       : $this->setDefaultSort('date_added', 'desc');

--------------------------------
File       : app/code/core/Mage/Adminhtml/Block/System/Convert/Profile/Edit/Tab/History.php:40
Reason     : TooManyArgument
Snippet    : $this->setDefaultSort('performed_at', 'desc')
Line       : $this->setDefaultSort('performed_at', 'desc');

--------------------------------
File       : app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Locale/Timezone.php:52
Reason     : TooManyArgument
Snippet    : DateTimeZone::listIdentifiers($allWithBc)
Line       : if (!in_array($this->getValue(), DateTimeZone::listIdentifiers($allWithBc))) {

--------------------------------
File       : app/code/core/Mage/Catalog/Model/Resource/Category/Tree.php:253
Reason     : TooManyArgument
Snippet    : $this->_getItemIsActive($parent->getId(), $storeId)
Line       : if (!$this->_getItemIsActive($parent->getId(), $storeId)){

--------------------------------
File       : app/code/core/Mage/Install/Model/Observer.php:48
Reason     : UseVoidReturn
Snippet    : Mage::printException($observer->getEvent()->getException())
Line       : echo Mage::printException($observer->getEvent()->getException());

--------------------------------
File       : app/code/core/Mage/Checkout/Model/Api/Resource/Product.php:102
Reason     : UseVoidReturn
Snippet    : Mage::throwException($cartCandidates)
Line       : throw Mage::throwException($cartCandidates);

--------------------------------
File       : app/code/core/Mage/Directory/Model/Observer.php:57
Reason     : UseVoidReturn
Snippet    : Mage::throwException(Mage::helper('directory')->__('Unable to initialize the import model.'))
Line       : $importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::throwException(Mage::helper('directory')->__('Unable to initialize the import model.'));

--------------------------------
File       : app/code/core/Mage/Adminhtml/controllers/Promo/QuoteController.php:276
Reason     : UseVoidReturn
Snippet    : $this->_initRule()
Line       : $this->_initRule()->loadLayout()->renderLayout();

--------------------------------
ghost commented 11 years ago

@rlerdorf I'm curious that how can you generate this information ?

rlerdorf commented 11 years ago

hhvm --hphp -t analyze

ghost commented 11 years ago

@rlerdorf thanks for sharing your secr3t :)