From 8cfe44e9c3078c8e7ae049360eff50cfbd2910a1 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 11 Nov 2023 21:49:15 +0100 Subject: [PATCH 01/16] Add MkDocs workflow to publish documentation --- .github/workflows/docs.yml | 36 +++++++++++ mkdocs.yml | 123 +++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 .github/workflows/docs.yml create mode 100644 mkdocs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000000..99080af2897 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,36 @@ +name: MkDocs + +on: + push: + branches: + - main + - documentation + paths: + - 'docs/**.md' + - 'mkdocs.yml' +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + + - uses: actions/cache@v3 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip3 install / + mkdocs / + mkdocs-material / + mkdocs-minify-plugin / + mkdocs-redirects + + - name: Publish docs + run: mkdocs gh-deploy --force diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 00000000000..82bf01e038c --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,123 @@ +# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json +site_name: OpenMage Docs +site_url: https://github.readthedocs.io/en/latest/ +repo_url: https://github.com/OpenMage/magento-lts +repo_name: OpenMage/magento-lts +edit_uri: blob/main/docs/content +copyright: OpenMage contributors +site_author: OpenMage contributors +site_description: >- + Magento - Long Term Support. +docs_dir: docs/content + +# Configuration +theme: + name: material + custom_dir: docs/overrides + palette: + - scheme: default + primary: deep purple + accent: deep purple + features: + - content.code.copy + - navigation.expand + - navigation.indexes + - navigation.instant + - navigation.sections + - navigation.tabs + - navigation.top + - navigation.tracking + +# Plugins +plugins: + - search + - redirects: + redirect_maps: + - minify: + minify_html: true + +# Customization +extra: + social: + - icon: fontawesome/brands/github + link: https://github.com/OpenMage/magento-lts + - icon: fontawesome/brands/discord + link: https://discord.gg/EV8aNbU + - icon: fontawesome/brands/stack-overflow + link: https://magento.stackexchange.com/tags/openmage + - icon: fontawesome/brands/twitter + link: https://twitter.com/openmageproject + generator: false + +# Extensions +markdown_extensions: + - abbr + - admonition + - attr_list + - def_list + - footnotes + - meta + - md_in_html + - toc: + permalink: true + toc_depth: 2 + - pymdownx.arithmatex: + generic: true + - pymdownx.betterem: + smart_enable: all + - pymdownx.caret + - pymdownx.details + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.keys + - pymdownx.magiclink: + repo_url_shorthand: true + user: OpenMage + repo: magento-lts + - pymdownx.mark + - pymdownx.smartsymbols + - pymdownx.superfences: + - pymdownx.tabbed: + alternate_style: true + - pymdownx.tasklist: + custom_checkbox: true + - pymdownx.tilde + - smarty + +nav: + - 'Get started': + - index.md + - users/requirements.md + - 'Installing': + - users/install/index.md + - users/install/use-composer.md + - users/install/use-git.md + - users/install/use-tarball.md + - users/install/secure-install.md + - 'Changelog': + - developers/changelog/index.md + - developers/changelog/new-config.md + - developers/changelog/new-events.md + - developers/changelog/soap-wsdl.md + - 'Versioning': + - users/versioning/index.md + - users/versioning/maintained.md + - 'Modules': + - users/modules/index.md + - users/modules/payment.md + - users/modules/themes.md + - users/modules/more.md + - 'Development': + - 'Events': + - developers/events/observer.md + - developers/events/list.md + - 'Tools': + - developers/ddev.md + - developers/phpstorm.md + - 'Multistore': + - developers/error-pages.md + - 'Documentation': + - developers/mkdocs.md + - 'Guides': + - developers/guides/add-dynamic-block-contents-in-category-page.md From 71bb2233befffb13092f12971efc81d6882ce7f5 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 11 Nov 2023 22:00:42 +0100 Subject: [PATCH 02/16] Fixed MkDocs workflow --- .github/workflows/docs.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 99080af2897..623e68c2170 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -26,11 +26,7 @@ jobs: path: .cache restore-keys: | mkdocs-material- - - run: pip3 install / - mkdocs / - mkdocs-material / - mkdocs-minify-plugin / - mkdocs-redirects + - run: pip3 install mkdocs mkdocs-material mkdocs-minify-plugin mkdocs-redirects - name: Publish docs run: mkdocs gh-deploy --force From 56004fd212700ba91b3a5c471720eab6109f2686 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 11 Nov 2023 22:02:22 +0100 Subject: [PATCH 03/16] Fixed MkDocs workflow (2) --- .github/workflows/docs.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 623e68c2170..12a7c9b8d33 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,6 +1,10 @@ name: MkDocs on: + workflow_call: + # Allow manually triggering the workflow. + workflow_dispatch: + push: branches: - main From 3181ce2a2a111e3b1543ddcd67bd203bc136a0d1 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:18:14 +0100 Subject: [PATCH 04/16] Assert some types --- app/code/core/Mage/Admin/Model/Resource/Acl.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/code/core/Mage/Admin/Model/Resource/Acl.php b/app/code/core/Mage/Admin/Model/Resource/Acl.php index 8c6887dcc66..21c2ab538f9 100644 --- a/app/code/core/Mage/Admin/Model/Resource/Acl.php +++ b/app/code/core/Mage/Admin/Model/Resource/Acl.php @@ -55,6 +55,7 @@ public function loadAcl() $rolesArr = $adapter->fetchAll($select); + assert(is_array($rolesArr)); $this->loadRoles($acl, $rolesArr); $select = $adapter->select() @@ -67,6 +68,7 @@ public function loadAcl() $rulesArr = $adapter->fetchAll($select); + assert(is_array($rulesArr)); $this->loadRules($acl, $rulesArr); return $acl; @@ -93,7 +95,7 @@ public function loadRoles(Mage_Admin_Model_Acl $acl, array $rolesArr) $roleId = $role['role_type'] . $role['user_id']; if (!$acl->hasRole($roleId)) { $acl->addRole(Mage::getModel('admin/acl_role_user', $roleId), $parent); - } else { + } elseif ($parent !== null) { $acl->addRoleParent($roleId, $parent); } break; @@ -118,9 +120,13 @@ public function loadRules(Mage_Admin_Model_Acl $acl, array $rulesArr) $privileges = !empty($rule['privileges']) ? explode(',', $rule['privileges']) : null; $assert = null; - if ($rule['assert_id'] != 0) { - $assertClass = Mage::getSingleton('admin/config')->getAclAssert($rule['assert_type'])->getClassName(); - $assert = new $assertClass(unserialize($rule['assert_data'], ['allowed_classes' => false])); + if ($rule['assert_id'] !== '0') { + $assertType = Mage::getSingleton('admin/config')->getAclAssert($rule['assert_type']); + if ($assertType) { + assert($assertType instanceof Mage_Core_Model_Config_Element); + $assertClass = $assertType->getClassName(); + $assert = new $assertClass(unserialize($rule['assert_data'], ['allowed_classes' => false])); + } } try { if ($rule['permission'] == 'allow') { From 697dd1b539aa82e1f6b8d0b4e9c913bc33cc765a Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:19:35 +0100 Subject: [PATCH 05/16] Follow naming from parent method --- .../core/Mage/Admin/Model/Resource/Roles.php | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/code/core/Mage/Admin/Model/Resource/Roles.php b/app/code/core/Mage/Admin/Model/Resource/Roles.php index 91e0d6efd03..446ab6f170f 100644 --- a/app/code/core/Mage/Admin/Model/Resource/Roles.php +++ b/app/code/core/Mage/Admin/Model/Resource/Roles.php @@ -46,35 +46,35 @@ protected function _construct() /** * Process role before saving * - * @param Mage_Core_Model_Abstract|Mage_Admin_Model_Roles $role + * @param Mage_Admin_Model_Roles $object * @return $this */ - protected function _beforeSave(Mage_Core_Model_Abstract $role) + protected function _beforeSave(Mage_Core_Model_Abstract $object) { - if ($role->getId() == '') { - if ($role->getIdFieldName()) { - $role->unsetData($role->getIdFieldName()); + if ($object->getId() == '') { + if ($object->getIdFieldName()) { + $object->unsetData($object->getIdFieldName()); } else { - $role->unsetData('id'); + $object->unsetData('id'); } } - if ($role->getPid() > 0) { + if ($object->getPid() > 0) { $select = $this->_getReadAdapter()->select() ->from($this->getMainTable(), ['tree_level']) ->where("{$this->getIdFieldName()} = :pid"); $binds = [ - 'pid' => (int) $role->getPid(), + 'pid' => (int) $object->getPid(), ]; - $treeLevel = $this->_getReadAdapter()->fetchOne($select, $binds); + $treeLevel = (int) $this->_getReadAdapter()->fetchOne($select, $binds); } else { $treeLevel = 0; } - $role->setTreeLevel($treeLevel + 1); - $role->setRoleName($role->getName()); + $object->setTreeLevel($treeLevel + 1); + $object->setRoleName($object->getName()); return $this; } @@ -82,12 +82,12 @@ protected function _beforeSave(Mage_Core_Model_Abstract $role) /** * Process role after saving * - * @param Mage_Core_Model_Abstract $role + * @param Mage_Admin_Model_Roles $object * @return $this */ - protected function _afterSave(Mage_Core_Model_Abstract $role) + protected function _afterSave(Mage_Core_Model_Abstract $object) { - $this->_updateRoleUsersAcl($role); + $this->_updateRoleUsersAcl($object); Mage::app()->getCache()->clean( Zend_Cache::CLEANING_MODE_MATCHING_TAG, [Mage_Adminhtml_Block_Page_Menu::CACHE_TAGS] @@ -98,14 +98,14 @@ protected function _afterSave(Mage_Core_Model_Abstract $role) /** * Process role after deleting * - * @param Mage_Core_Model_Abstract $role + * @param Mage_Admin_Model_Roles $object * @return $this */ - protected function _afterDelete(Mage_Core_Model_Abstract $role) + protected function _afterDelete(Mage_Core_Model_Abstract $object) { $adapter = $this->_getWriteAdapter(); - $adapter->delete($this->getMainTable(), ['parent_id = ?' => (int) $role->getId()]); - $adapter->delete($this->_ruleTable, ['role_id = ?' => (int) $role->getId()]); + $adapter->delete($this->getMainTable(), ['parent_id = ?' => (int) $object->getId()]); + $adapter->delete($this->_ruleTable, ['role_id = ?' => (int) $object->getId()]); return $this; } From 44d76650984673c8223ed00a878d2ff2c250c229 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:23:19 +0100 Subject: [PATCH 06/16] Follow naming from parent method, removed unused private method --- .../core/Mage/Admin/Model/Resource/User.php | 65 ++++++++----------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/app/code/core/Mage/Admin/Model/Resource/User.php b/app/code/core/Mage/Admin/Model/Resource/User.php index e834f921ce9..0a851341db2 100644 --- a/app/code/core/Mage/Admin/Model/Resource/User.php +++ b/app/code/core/Mage/Admin/Model/Resource/User.php @@ -72,7 +72,7 @@ public function recordLogin(Mage_Admin_Model_User $user) * Load data by specified username * * @param string $username - * @return false|array + * @return array */ public function loadByUsername($username) { @@ -124,42 +124,31 @@ public function hasAssigned2Role($user) } } - /** - * Encrypt password - * - * @param string $pwStr - * @return string - */ - private function _encryptPassword($pwStr) - { - return Mage::helper('core')->getHash($pwStr, Mage_Admin_Model_User::HASH_SALT_LENGTH); - } - /** * Set created/modified values before user save * - * @param Mage_Admin_Model_User $user + * @param Mage_Admin_Model_User $object * @inheritDoc */ - protected function _beforeSave(Mage_Core_Model_Abstract $user) + protected function _beforeSave(Mage_Core_Model_Abstract $object) { - if ($user->isObjectNew()) { - $user->setCreated($this->formatDate(true)); + if ($object->isObjectNew()) { + $object->setCreated($this->formatDate(true)); } - $user->setModified($this->formatDate(true)); + $object->setModified($this->formatDate(true)); - return parent::_beforeSave($user); + return parent::_beforeSave($object); } /** * Unserialize user extra data after user save * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Admin_Model_User $object * @return $this */ - protected function _afterSave(Mage_Core_Model_Abstract $user) + protected function _afterSave(Mage_Core_Model_Abstract $object) { - $this->_unserializeExtraData($user); + $this->_unserializeExtraData($object); return $this; } @@ -168,24 +157,24 @@ protected function _afterSave(Mage_Core_Model_Abstract $user) * * @inheritDoc */ - protected function _afterLoad(Mage_Core_Model_Abstract $user) + protected function _afterLoad(Mage_Core_Model_Abstract $object) { - return parent::_afterLoad($this->_unserializeExtraData($user)); + return parent::_afterLoad($this->_unserializeExtraData($object)); } /** * Delete user role record with user * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Admin_Model_User $object * @return $this * @throws Exception */ - public function delete(Mage_Core_Model_Abstract $user) + public function delete(Mage_Core_Model_Abstract $object) { - $this->_beforeDelete($user); + $this->_beforeDelete($object); $adapter = $this->_getWriteAdapter(); - $uid = $user->getId(); + $uid = $object->getId(); $adapter->beginTransaction(); try { $conditions = [ @@ -199,14 +188,14 @@ public function delete(Mage_Core_Model_Abstract $user) $adapter->rollBack(); throw $e; } - $this->_afterDelete($user); + $this->_afterDelete($object); return $this; } /** * TODO: unify _saveRelations() and add() methods, they make same things * - * @param Mage_Core_Model_Abstract|Mage_Admin_Model_User $user + * @param Mage_Admin_Model_User $user * @return $this|Mage_Core_Model_Abstract */ public function _saveRelations(Mage_Core_Model_Abstract $user) @@ -265,7 +254,7 @@ public function _saveRelations(Mage_Core_Model_Abstract $user) /** * Get user roles * - * @param Mage_Core_Model_Abstract $user + * @param Mage_Admin_Model_User $user * @return array */ public function getRoles(Mage_Core_Model_Abstract $user) @@ -301,15 +290,15 @@ public function getRoles(Mage_Core_Model_Abstract $user) /** * Save user roles * - * @param Mage_Core_Model_Abstract|Mage_Admin_Model_User $user + * @param Mage_Admin_Model_User $user * @return $this */ public function add(Mage_Core_Model_Abstract $user) { $dbh = $this->_getWriteAdapter(); $aRoles = $this->hasAssigned2Role($user); - if (count($aRoles)) { - foreach ($aRoles as $idx => $data) { + if ($aRoles !== null && count($aRoles)) { + foreach ($aRoles as $data) { $dbh->delete( $this->getTable('admin/role'), ['role_id = ?' => $data['role_id']] @@ -346,7 +335,7 @@ public function add(Mage_Core_Model_Abstract $user) /** * Delete user role * - * @param Mage_Core_Model_Abstract|Mage_Admin_Model_User $user + * @param Mage_Admin_Model_User $user * @return $this */ public function deleteFromRole(Mage_Core_Model_Abstract $user) @@ -372,7 +361,7 @@ public function deleteFromRole(Mage_Core_Model_Abstract $user) /** * Check if role user exists * - * @param Mage_Core_Model_Abstract|Mage_Admin_Model_User $user + * @param Mage_Admin_Model_User $user * @return array */ public function roleUserExists(Mage_Core_Model_Abstract $user) @@ -400,7 +389,7 @@ public function roleUserExists(Mage_Core_Model_Abstract $user) /** * Check if user exists * - * @param Mage_Core_Model_Abstract|Mage_Admin_Model_User $user + * @param Mage_Admin_Model_User $user * @return array|false */ public function userExists(Mage_Core_Model_Abstract $user) @@ -424,7 +413,7 @@ public function userExists(Mage_Core_Model_Abstract $user) /** * Save user extra data * - * @param Mage_Core_Model_Abstract $object + * @param Mage_Admin_Model_User $object * @param string $data * @return $this */ @@ -444,7 +433,7 @@ public function saveExtra($object, $data) /** * Set reload ACL flag * - * @param Mage_Core_Model_Abstract $object + * @param Mage_Admin_Model_User $object * @param int $flag * @return $this */ From c86a6b647a6f1ee7998d32b5f98041916f339b55 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:24:39 +0100 Subject: [PATCH 07/16] Updated DocBlock --- app/code/core/Mage/Admin/Model/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/core/Mage/Admin/Model/User.php b/app/code/core/Mage/Admin/Model/User.php index b10e26a982f..8ffdfc066e6 100644 --- a/app/code/core/Mage/Admin/Model/User.php +++ b/app/code/core/Mage/Admin/Model/User.php @@ -720,7 +720,7 @@ public function cleanPasswordsValidationData() /** * Simple sql format date * - * @param string|bool $dayOnly + * @param bool $dayOnly * @return string */ protected function _getDateNow($dayOnly = false) From 25ae2579f6ed50d4122420c2b558a507ce4b53a0 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:33:51 +0100 Subject: [PATCH 08/16] Fixes for phpstan - `$var->disabled` implements `__toString()`, so casting should be okay --- app/code/core/Mage/Admin/Model/Config.php | 6 +++--- app/code/core/Mage/Admin/Model/Roles.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/core/Mage/Admin/Model/Config.php b/app/code/core/Mage/Admin/Model/Config.php index e2a4e17b0f7..6a88be2ced2 100644 --- a/app/code/core/Mage/Admin/Model/Config.php +++ b/app/code/core/Mage/Admin/Model/Config.php @@ -101,7 +101,7 @@ public function loadAclResources(Mage_Admin_Model_Acl $acl, $resource = null, $p } foreach ($children as $res) { - if ($res->disabled == 1) { + if ((string)$res->disabled === '1') { continue; } $this->loadAclResources($acl, $res, $resourceName); @@ -117,7 +117,7 @@ public function loadAclResources(Mage_Admin_Model_Acl $acl, $resource = null, $p */ public function getAclAssert($name = '') { - $asserts = $this->getNode("admin/acl/asserts"); + $asserts = $this->getNode('admin/acl/asserts'); if ($name === '') { return $asserts; } @@ -133,7 +133,7 @@ public function getAclAssert($name = '') */ public function getAclPrivilegeSet($name = '') { - $sets = $this->getNode("admin/acl/privilegeSets"); + $sets = $this->getNode('admin/acl/privilegeSets'); if ($name === '') { return $sets; } diff --git a/app/code/core/Mage/Admin/Model/Roles.php b/app/code/core/Mage/Admin/Model/Roles.php index a12498b9e94..fca410d1712 100644 --- a/app/code/core/Mage/Admin/Model/Roles.php +++ b/app/code/core/Mage/Admin/Model/Roles.php @@ -162,7 +162,7 @@ protected function _buildResourcesArray( //check children and run recursion if they exists $children = $resource->children(); foreach ($children as $key => $child) { - if ($child->disabled == 1) { + if ((string)$child->disabled === '1') { $resource->{$key} = null; continue; } From df3d97ae57a17cfa15a2a7af3ecb9dc76012ef75 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:35:25 +0100 Subject: [PATCH 09/16] Added patch to fix some phpstan errors --- ...tan-zend-controller-fluent-interface.patch | 332 ++++++++++++++++++ 1 file changed, 332 insertions(+) create mode 100644 patches/shardj-zf1-future/phpstan-zend-controller-fluent-interface.patch diff --git a/patches/shardj-zf1-future/phpstan-zend-controller-fluent-interface.patch b/patches/shardj-zf1-future/phpstan-zend-controller-fluent-interface.patch new file mode 100644 index 00000000000..85d2cbea3d9 --- /dev/null +++ b/patches/shardj-zf1-future/phpstan-zend-controller-fluent-interface.patch @@ -0,0 +1,332 @@ +--- /dev/null ++++ ../library/Zend/Controller/Request/Abstract.php +@@ -93,7 +93,7 @@ + * Set the module name to use + * + * @param string $value +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function setModuleName($value) + { +@@ -119,7 +119,7 @@ + * Set the controller name to use + * + * @param string $value +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function setControllerName($value) + { +@@ -145,7 +145,7 @@ + * Set the action name + * + * @param string $value +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function setActionName($value) + { +@@ -173,7 +173,7 @@ + * Set the module key + * + * @param string $key +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function setModuleKey($key) + { +@@ -195,7 +195,7 @@ + * Set the controller key + * + * @param string $key +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function setControllerKey($key) + { +@@ -217,7 +217,7 @@ + * Set the action key + * + * @param string $key +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function setActionKey($key) + { +@@ -275,7 +275,7 @@ + * + * @param string $key + * @param mixed $value +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function setParam($key, $value) + { +@@ -306,7 +306,7 @@ + * Null values will unset the associated key. + * + * @param array $array +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function setParams(array $array) + { +@@ -324,7 +324,7 @@ + /** + * Unset all user parameters + * +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function clearParams() + { +@@ -336,7 +336,7 @@ + * Set flag indicating whether or not request has been dispatched + * + * @param boolean $flag +- * @return Zend_Controller_Request_Abstract ++ * @return $this + */ + public function setDispatched($flag = true) + { + +--- /dev/null ++++ ../library/Zend/Controller/Request/Http.php +@@ -244,7 +244,7 @@ + * + * @param string|array $spec + * @param null|mixed $value +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setQuery($spec, $value = null) + { +@@ -288,7 +288,7 @@ + * + * @param string|array $spec + * @param null|mixed $value +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setPost($spec, $value = null) + { +@@ -395,7 +395,7 @@ + * or $_SERVER['ORIG_PATH_INFO'] + $_SERVER['QUERY_STRING']. + * + * @param string $requestUri +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setRequestUri($requestUri = null) + { +@@ -478,7 +478,7 @@ + * ORIG_SCRIPT_NAME in its determination. + * + * @param mixed $baseUrl +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setBaseUrl($baseUrl = null) + { +@@ -572,7 +572,7 @@ + * Set the base path for the URL + * + * @param string|null $basePath +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setBasePath($basePath = null) + { +@@ -621,7 +621,7 @@ + * Set the PATH_INFO string + * + * @param string|null $pathInfo +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setPathInfo($pathInfo = null) + { +@@ -681,7 +681,7 @@ + * Can be empty array, or contain one or more of '_GET' or '_POST'. + * + * @param array $paramSoures +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setParamSources(array $paramSources = []) + { +@@ -707,7 +707,7 @@ + * + * @param mixed $key + * @param mixed $value +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setParam($key, $value) + { +@@ -780,7 +780,7 @@ + * using the keys specified in the array. + * + * @param array $params +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setParams(array $params) + { +@@ -798,7 +798,7 @@ + * + * @param string $name + * @param string $target +- * @return Zend_Controller_Request_Http ++ * @return $this + */ + public function setAlias($name, $target) + { + +--- /dev/null ++++ ../library/Zend/Controller/Response/Abstract.php +@@ -108,7 +108,7 @@ + * @param string $name + * @param string $value + * @param boolean $replace +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function setHeader($name, $value, $replace = false) + { +@@ -141,7 +141,7 @@ + * + * @param string $url + * @param int $code +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function setRedirect($url, $code = 302) + { +@@ -175,7 +175,7 @@ + /** + * Clear headers + * +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function clearHeaders() + { +@@ -188,7 +188,7 @@ + * Clears the specified HTTP header + * + * @param string $name +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function clearHeader($name) + { +@@ -211,7 +211,7 @@ + * Allows setting non key => value headers, such as status codes + * + * @param string $value +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function setRawHeader($value) + { +@@ -236,7 +236,7 @@ + /** + * Clear all {@link setRawHeader() raw HTTP headers} + * +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function clearRawHeaders() + { +@@ -248,7 +248,7 @@ + * Clears the specified raw HTTP header + * + * @param string $headerRaw +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function clearRawHeader($headerRaw) + { +@@ -267,7 +267,7 @@ + /** + * Clear all headers, normal and raw + * +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function clearAllHeaders() + { +@@ -279,7 +279,7 @@ + * Set HTTP response code to use with headers + * + * @param int $code +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function setHttpResponseCode($code) + { +@@ -332,7 +332,7 @@ + * Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} + * has been specified, it is sent with the first header. + * +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function sendHeaders() + { +@@ -383,7 +383,7 @@ + * + * @param string $content + * @param null|string $name +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function setBody($content, $name = null) + { +@@ -401,7 +401,7 @@ + * + * @param string $content + * @param null|string $name +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function appendBody($content, $name = null) + { +@@ -480,7 +480,7 @@ + * + * @param string $name + * @param string $content +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function append($name, $content) + { +@@ -504,7 +504,7 @@ + * + * @param string $name + * @param string $content +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function prepend($name, $content) + { +@@ -531,7 +531,7 @@ + * @param string $parent + * @param boolean $before Whether to insert the new segment before or + * after the parent. Defaults to false (after) +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function insert($name, $content, $parent = null, $before = false) + { +@@ -592,7 +592,7 @@ + * Register an exception with the response + * + * @param Throwable $e +- * @return Zend_Controller_Response_Abstract ++ * @return $this + */ + public function setException(Throwable $e) + { From 9905e590d5e14587a5d4cda6aa2d3b21f417c53b Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:38:15 +0100 Subject: [PATCH 10/16] Re-added all pages to repo --- patches/shardj-zf1-future/magento-1.1.1.patch | 11 +++ .../shardj-zf1-future/magento-1.9.3.0.patch | 45 ++++++++++ .../shardj-zf1-future/magento-1.9.3.7.patch | 15 ++++ patches/shardj-zf1-future/openmage-1081.patch | 13 +++ patches/shardj-zf1-future/openmage-2047.patch | 49 +++++++++++ patches/shardj-zf1-future/openmage-2050.patch | 12 +++ patches/shardj-zf1-future/openmage-918.patch | 82 +++++++++++++++++++ 7 files changed, 227 insertions(+) create mode 100644 patches/shardj-zf1-future/magento-1.1.1.patch create mode 100644 patches/shardj-zf1-future/magento-1.9.3.0.patch create mode 100644 patches/shardj-zf1-future/magento-1.9.3.7.patch create mode 100644 patches/shardj-zf1-future/openmage-1081.patch create mode 100644 patches/shardj-zf1-future/openmage-2047.patch create mode 100644 patches/shardj-zf1-future/openmage-2050.patch create mode 100644 patches/shardj-zf1-future/openmage-918.patch diff --git a/patches/shardj-zf1-future/magento-1.1.1.patch b/patches/shardj-zf1-future/magento-1.1.1.patch new file mode 100644 index 00000000000..3399b19526f --- /dev/null +++ b/patches/shardj-zf1-future/magento-1.1.1.patch @@ -0,0 +1,11 @@ +--- /dev/null ++++ ../library/Zend/Mime.php +@@ -38,7 +38,7 @@ + const ENCODING_BASE64 = 'base64'; + const DISPOSITION_ATTACHMENT = 'attachment'; + const DISPOSITION_INLINE = 'inline'; +- const LINELENGTH = 72; ++ const LINELENGTH = 200; + const LINEEND = "\n"; + const MULTIPART_ALTERNATIVE = 'multipart/alternative'; + const MULTIPART_MIXED = 'multipart/mixed'; diff --git a/patches/shardj-zf1-future/magento-1.9.3.0.patch b/patches/shardj-zf1-future/magento-1.9.3.0.patch new file mode 100644 index 00000000000..d0108c0dcdd --- /dev/null +++ b/patches/shardj-zf1-future/magento-1.9.3.0.patch @@ -0,0 +1,45 @@ +--- /dev/null ++++ ../library/Zend/Validate/Hostname.php +@@ -2188,7 +2188,9 @@ + $this->_tld = $matches[1]; + if ($this->_options['tld']) { + if (!in_array(strtolower($this->_tld), $this->_validTlds) +- && !in_array($this->_tld, $this->_validTlds)) { ++ && !in_array($this->_tld, $this->_validTlds) ++ && !$this->checkDnsRecords($this->_value) ++ ) { + $this->_error(self::UNKNOWN_TLD); + $status = false; + break; +@@ -2422,5 +2424,31 @@ + } + + return implode($decoded); ++ } ++ ++ /** ++ * Returns true if any DNS records corresponding to a given Internet host are found. ++ * Returns false if no DNS records were found or if an error occurred. ++ * Checks A-Record. ++ * ++ * @param string $hostName ++ * ++ * @return bool ++ */ ++ protected function checkDnsRecords($hostName) ++ { ++ if (function_exists('idn_to_ascii')) { ++ if (defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46')) { ++ $toAscii = idn_to_ascii($hostName, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46); ++ } else { ++ $toAscii = idn_to_ascii($hostName); ++ } ++ $result = checkdnsrr($toAscii, 'A'); ++ } else { ++ $idn = new Net_IDNA2(); ++ $result = checkdnsrr($idn->encode($hostName), 'A'); ++ } ++ ++ return $result; + } + } diff --git a/patches/shardj-zf1-future/magento-1.9.3.7.patch b/patches/shardj-zf1-future/magento-1.9.3.7.patch new file mode 100644 index 00000000000..5c23f7857e5 --- /dev/null +++ b/patches/shardj-zf1-future/magento-1.9.3.7.patch @@ -0,0 +1,15 @@ +--- /dev/null ++++ ../library/Zend/Form/Decorator/Form.php +@@ -129,6 +129,12 @@ + $attribs = $this->getOptions(); + $name = $form->getFullyQualifiedName(); + $attribs['id'] = $form->getId(); ++ if ($helper == 'unserialize') { ++ $filter = new Varien_Filter_FormElementName(true); ++ if($filter->filter($name) != $name){ ++ throw new Zend_Form_Exception(sprintf('Invalid element name:"%s"', $name)); ++ } ++ } + return $view->$helper($name, $attribs, $content); + } + } diff --git a/patches/shardj-zf1-future/openmage-1081.patch b/patches/shardj-zf1-future/openmage-1081.patch new file mode 100644 index 00000000000..0c2524e8b60 --- /dev/null +++ b/patches/shardj-zf1-future/openmage-1081.patch @@ -0,0 +1,13 @@ +--- /dev/null ++++ ../library/Zend/Controller/Request/Http.php +@@ -1041,7 +1041,9 @@ + */ + public function getScheme() + { +- return ($this->getServer('HTTPS') == 'on') ? self::SCHEME_HTTPS : self::SCHEME_HTTP; ++ return (strtolower((string)$this->getServer('HTTPS')) == 'on') || $this->getServer('HTTP_X_FORWARDED_PROTO') == 'https' ? ++ self::SCHEME_HTTPS : ++ self::SCHEME_HTTP; + } + + /** diff --git a/patches/shardj-zf1-future/openmage-2047.patch b/patches/shardj-zf1-future/openmage-2047.patch new file mode 100644 index 00000000000..0f5590f24ff --- /dev/null +++ b/patches/shardj-zf1-future/openmage-2047.patch @@ -0,0 +1,49 @@ +--- /dev/null ++++ ../library/Zend/Cloud/DocumentService/Adapter/WindowsAzure.php +@@ -525,7 +525,7 @@ + */ + protected function _validateKey($key) + { +- if (preg_match('@[/#?' . preg_quote('\\') . ']@', $key)) { ++ if (preg_match('@[/#?' . preg_quote('\\', '@') . ']@', $key)) { + throw new Zend_Cloud_DocumentService_Exception('Invalid partition or row key provided; must not contain /, \\, #, or ? characters'); + } + } + +--- /dev/null ++++ ../library/Zend/Db/Statement.php +@@ -185,11 +185,11 @@ + // e.g. \' or '' + $qe = $this->_adapter->quote($q); + $qe = substr($qe, 1, 2); +- $qe = preg_quote($qe); ++ $qe = preg_quote($qe, '/'); + $escapeChar = substr($qe,0,1); + // remove 'foo\'bar' + if (!empty($q)) { +- $escapeChar = preg_quote($escapeChar); ++ $escapeChar = preg_quote($escapeChar, '/'); + // this segfaults only after 65,000 characters instead of 9,000 + $sql = preg_replace("/$q([^$q{$escapeChar}]*|($qe)*)*$q/s", '', $sql); + } +@@ -207,7 +207,7 @@ + // e.g. \" or "" or \` + $de = $this->_adapter->quoteIdentifier($d); + $de = substr($de, 1, 2); +- $de = preg_quote($de); ++ $de = preg_quote($de, '/'); + // Note: $de and $d where never used..., now they are: + $sql = preg_replace("/$d($de|\\\\{2}|[^$d])*$d/Us", '', $sql); + return $sql; + +--- /dev/null ++++ ../library/Zend/Http/Cookie.php +@@ -396,7 +396,7 @@ + + // Check for either exact match or suffix match + return ($cookieDomain == $host || +- preg_match('/\.' . preg_quote($cookieDomain) . '$/', $host)); ++ preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $host)); + } + + /** diff --git a/patches/shardj-zf1-future/openmage-2050.patch b/patches/shardj-zf1-future/openmage-2050.patch new file mode 100644 index 00000000000..a208019cbd8 --- /dev/null +++ b/patches/shardj-zf1-future/openmage-2050.patch @@ -0,0 +1,12 @@ +--- /dev/null ++++ ../library/Zend/Date.php +@@ -541,7 +541,8 @@ + } + + if (($part !== null) && !defined($part) +- && ($part != 'ee') && ($part != 'ss') && ($part != 'GG') && ($part != 'MM') && ($part != 'EE') && ($part != 'TT') ++ && ($part !== 'ee') && ($part !== 'ss') && ($part !== 'GG') && ($part !== 'MM') && ($part !== 'EE') && ($part !== 'TT') ++ && ($part !== 'U') && ($part !== 'X') && ($part !== 'c') + && Zend_Locale::isLocale($part, null, false)) { + $locale = $part; + $part = null; diff --git a/patches/shardj-zf1-future/openmage-918.patch b/patches/shardj-zf1-future/openmage-918.patch new file mode 100644 index 00000000000..185d7e30fd8 --- /dev/null +++ b/patches/shardj-zf1-future/openmage-918.patch @@ -0,0 +1,82 @@ +--- /dev/null ++++ ../library/Zend/Locale/Data.php +@@ -75,6 +75,13 @@ + private static $_cacheDisabled = false; + + /** ++ * Internal cache, prevent repeated cache requests ++ * ++ * @var array ++ */ ++ private static $_localCache = []; ++ ++ /** + * Read the content from locale + * + * Can be called like: +@@ -335,8 +342,15 @@ + + $val = urlencode((string) $val); + $id = self::_filterCacheId('Zend_LocaleL_' . $locale . '_' . $path . '_' . $val); ++ ++ // add runtime cache to avoid calling cache backend multiple times during one request ++ if (isset(self::$_localCache[$id])) { ++ return self::$_localCache[$id]; ++ } + if (!self::$_cacheDisabled && ($result = self::$_cache->load($id))) { +- return unserialize($result); ++ $result = unserialize($result); ++ self::$_localCache[$id] = $result; ++ return $result; + } + + $temp = []; +@@ -946,11 +960,13 @@ + } + + if (isset(self::$_cache)) { ++ $data = serialize($temp); + if (self::$_cacheTags) { +- self::$_cache->save( serialize($temp), $id, ['Zend_Locale']); ++ self::$_cache->save( $data, $id, ['Zend_Locale']); + } else { +- self::$_cache->save( serialize($temp), $id); ++ self::$_cache->save( $data, $id); + } ++ static::$_localCache[$id] = $temp; + } + + return $temp; +@@ -984,8 +1000,15 @@ + } + $val = urlencode((string) $val); + $id = self::_filterCacheId('Zend_LocaleC_' . $locale . '_' . $path . '_' . $val); ++ ++ // add runtime cache to avoid calling cache backend multiple times during one request ++ if (isset(self::$_localCache[$id])) { ++ return self::$_localCache[$id]; ++ } + if (!self::$_cacheDisabled && ($result = self::$_cache->load($id))) { +- return unserialize($result); ++ $result = unserialize($result); ++ self::$_localCache[$id] = $result; ++ return $result; + } + + switch(strtolower($path)) { +@@ -1499,11 +1522,13 @@ + $temp = current($temp); + } + if (isset(self::$_cache)) { ++ $data = serialize($temp); + if (self::$_cacheTags) { +- self::$_cache->save( serialize($temp), $id, ['Zend_Locale']); ++ self::$_cache->save( $data, $id, ['Zend_Locale']); + } else { +- self::$_cache->save( serialize($temp), $id); ++ self::$_cache->save( $data, $id); + } ++ static::$_localCache[$id] = $temp; + } + + return $temp; From 8199fedeb072b65ae543cf4c97950ec549082eb6 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:38:54 +0100 Subject: [PATCH 11/16] Fixed DocBlock --- app/code/core/Mage/Core/Helper/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/core/Mage/Core/Helper/Data.php b/app/code/core/Mage/Core/Helper/Data.php index 3709fd70de4..9b931d14818 100644 --- a/app/code/core/Mage/Core/Helper/Data.php +++ b/app/code/core/Mage/Core/Helper/Data.php @@ -703,7 +703,7 @@ public function jsonEncode($valueToEncode, $cycleCheck = false, $options = []) * * switch added to prevent exceptions in json_decode * - * @param string $encodedValue + * @param null|bool|string $encodedValue * @param int $objectDecodeType * @return mixed * @throws Zend_Json_Exception From 9b6474e29594200f1a35eea76f8177a5366da116 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:43:06 +0100 Subject: [PATCH 12/16] Updated phpstan config/baseline - ignored some errors related to missing type declaration - ignored some errors for higher levels, that cant be easily fixed --- phpstan.dist.baseline.neon | 89 +++++++++----------------------------- phpstan.dist.neon | 47 ++++++++++++++++++++ 2 files changed, 67 insertions(+), 69 deletions(-) diff --git a/phpstan.dist.baseline.neon b/phpstan.dist.baseline.neon index 8a1e7f903af..e0d9ffe45fd 100644 --- a/phpstan.dist.baseline.neon +++ b/phpstan.dist.baseline.neon @@ -10,46 +10,6 @@ parameters: count: 1 path: app/Mage.php - - - message: "#^Comparison operation \"\\=\\=\" between \\(Varien_Simplexml_Element\\|null\\) and 1 results in an error\\.$#" - count: 1 - path: app/code/core/Mage/Admin/Model/Config.php - - - - message: "#^Call to an undefined method Zend_Controller_Request_Http\\:\\:setRouteName\\(\\)\\.$#" - count: 1 - path: app/code/core/Mage/Admin/Model/Observer.php - - - - message: "#^Cannot call method getClassName\\(\\) on SimpleXMLElement\\|false\\.$#" - count: 1 - path: app/code/core/Mage/Admin/Model/Resource/Acl.php - - - - message: "#^Method Mage_Admin_Model_Resource_User\\:\\:_encryptPassword\\(\\) is unused\\.$#" - count: 1 - path: app/code/core/Mage/Admin/Model/Resource/User.php - - - - message: "#^Call to an undefined method Mage_Admin_Model_Resource_Roles\\:\\:update\\(\\)\\.$#" - count: 1 - path: app/code/core/Mage/Admin/Model/Roles.php - - - - message: "#^Comparison operation \"\\=\\=\" between \\(Varien_Simplexml_Element\\|null\\) and 1 results in an error\\.$#" - count: 1 - path: app/code/core/Mage/Admin/Model/Roles.php - - - - message: "#^Call to an undefined method Mage_Admin_Model_Resource_Rules\\:\\:update\\(\\)\\.$#" - count: 1 - path: app/code/core/Mage/Admin/Model/Rules.php - - - - message: "#^Call to an undefined method Zend_Controller_Response_Abstract\\:\\:sendHeadersAndExit\\(\\)\\.$#" - count: 1 - path: app/code/core/Mage/Admin/Model/Session.php - - message: "#^If condition is always true\\.$#" count: 1 @@ -645,11 +605,6 @@ parameters: count: 1 path: app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php - - - message: "#^Method Mage_Adminhtml_Sales_Order_ShipmentController\\:\\:getShippingItemsGridAction\\(\\) should return Mage_Core_Controller_Response_Http but returns Zend_Controller_Response_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php - - message: "#^Negated boolean expression is always false\\.$#" count: 1 @@ -920,11 +875,6 @@ parameters: count: 1 path: app/code/core/Mage/Api2/Model/Resource/Validator/Fields.php - - - message: "#^Method Mage_Api2_Model_Response\\:\\:setMimeType\\(\\) should return \\$this\\(Mage_Api2_Model_Response\\) but returns Zend_Controller_Response_Abstract\\.$#" - count: 1 - path: app/code/core/Mage/Api2/Model/Response.php - - message: "#^Parameter \\#1 \\$request \\(Mage_Api2_Model_Request\\) of method Mage_Api2_Model_Route_Abstract\\:\\:match\\(\\) should be compatible with parameter \\$path \\(string\\) of method Zend_Controller_Router_Route\\:\\:match\\(\\)$#" count: 1 @@ -5555,6 +5505,26 @@ parameters: count: 1 path: lib/Varien/Db/Statement/Pdo/Mysql.php + - + message: "#^Variable \\$aInfo might not be defined\\.$#" + count: 2 + path: lib/Varien/Db/Tree.php + + - + message: "#^Variable \\$pInfo might not be defined\\.$#" + count: 4 + path: lib/Varien/Db/Tree.php + + - + message: "#^Variable \\$sql might not be defined\\.$#" + count: 2 + path: lib/Varien/Db/Tree.php + + - + message: "#^Variable \\$methodName might not be defined\\.$#" + count: 2 + path: lib/Varien/Debug.php + - message: "#^Right side of && is always false\\.$#" count: 1 @@ -5619,22 +5589,3 @@ parameters: message: "#^Strict comparison using \\=\\=\\= between mixed and false will always evaluate to false\\.$#" count: 1 path: lib/Varien/Simplexml/Config.php - - - message: "#^Variable \\$aInfo might not be defined\\.$#" - count: 2 - path: lib/Varien/Db/Tree.php - - - - message: "#^Variable \\$pInfo might not be defined\\.$#" - count: 4 - path: lib/Varien/Db/Tree.php - - - - message: "#^Variable \\$sql might not be defined\\.$#" - count: 2 - path: lib/Varien/Db/Tree.php - - - - message: "#^Variable \\$methodName might not be defined\\.$#" - count: 2 - path: lib/Varien/Debug.php diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 76417afeff9..27cb9c621d4 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -70,6 +70,53 @@ parameters: # Instantiated class not found - lib/Varien/Image/Adapter.php + ignoreErrors: + - + # method does not exist and is not used anywhere - remove? + message: '#^Call to an undefined method Mage_Admin_Model_Resource_Roles::update+[\\(\\)]+.#' + count: 1 + path: app/code/core/Mage/Admin/Model/Roles.php + - + # method does not exist and is not used anywhere - remove? + message: '#^Call to an undefined method Mage_Admin_Model_Resource_Rules::update+[\\(\\)]+.#' + count: 1 + path: app/code/core/Mage/Admin/Model/Rules.php + - + # L6: we cannot add return types w/o breaking 3rd party code ... needs rector first + message: '#^Method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_\\(\\)]+ has no return type specified.#' + reportUnmatched: false + - + # L6: we cannot add detailed array types... too much work right now + # phpstan 1.11: see: https://phpstan.org/error-identifiers#gbi-missingtype.iterablevalue + # identifier: missingType.iterableValue + message: '#^Method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_\\(\\)]+ has parameter \$[a-zA-Z0-9\\_]+ with no value type specified in iterable type array.#' + reportUnmatched: false + - + # L6: we cannot add detailed array types... too much work right now + # identifier: missingType.iterableValue + message: '#^Method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_\\(\\)]+ return type has no value type specified in iterable type array.#' + reportUnmatched: false + - + # L6: we cannot add detailed array types... too much work right now + # identifier: missingType.iterableValue + message: '#^Property [a-zA-Z0-9\\_]+::\$[a-zA-Z0-9\\_]+ type has no value type specified in iterable type array.#' + reportUnmatched: false + - + # L7: comes from Mage::getConfig()->getNode() ... need further investigation + message: '#^Method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_\\(\\)]+ should return array\|Varien_Simplexml_Element but returns array\|Varien_Simplexml_Element\|false.#' + reportUnmatched: false + - + # L7: comes from Mage::getConfig()->getNode() ... need further investigation + message: '#^Cannot call method [a-zA-Z0-9\\_\\(\\)]+ on Varien_Simplexml_Element\|false.#' + reportUnmatched: false + - + # L7: comes from Mage::getConfig()->getNode() ... need further investigation + message: '#^Cannot access property \$[a-zA-Z0-9\\_]+ on Varien_Simplexml_Element\|false.#' + reportUnmatched: false + - + # L8: comes from Mage::getConfig()->getNode() ... need further investigation + message: '#^Cannot call method [a-zA-Z0-9\\_\\(\\)]+ on Mage_Core_Model_Config\|null.#' + reportUnmatched: false level: 4 checkFunctionNameCase: true checkInternalClassCaseSensitivity: true From 75501afbc1e8161277d60a42ccf96d3659651baa Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:45:18 +0100 Subject: [PATCH 13/16] Updated composer.json - change block orders come from "ddev vendor-patches" and should not happen again --- composer.json | 29 +++++++++++++++-------------- composer.lock | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 7a5dc23cd8e..53e0319c2e2 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "n98/n98_layouthelper": "*" }, "minimum-stability": "dev", - "prefer-stable" : true, + "prefer-stable": true, "authors": [ { "name": "Lee Saferite", @@ -84,6 +84,18 @@ } }, "extra": { + "patches": { + "shardj/zf1-future": { + "MAG-1.1.1": "patches/shardj-zf1-future/magento-1.1.1.patch", + "MAG-1.9.3.0": "patches/shardj-zf1-future/magento-1.9.3.0.patch", + "MAG-1.9.3.7 - SUPEE-10415": "patches/shardj-zf1-future/magento-1.9.3.7.patch", + "OM-918 - Add runtime cache to Zend_Locale_Data": "patches/shardj-zf1-future/openmage-918.patch", + "OM-1081 - Not detecting HTTPS behind a proxy": "patches/shardj-zf1-future/openmage-1081.patch", + "OM-2047 - Pass delimiter char to preg_quote": "patches/shardj-zf1-future/openmage-2047.patch", + "OM-2050 - Prevent checking known date codes": "patches/shardj-zf1-future/openmage-2050.patch", + "ZF1-XXX - Provide fuent interfacc for Zend_Controller": "patches/shardj-zf1-future/phpstan-zend-controller-fluent-interface.patch" + } + }, "magento-root-dir": ".", "magento-deploystrategy": "copy", "magento-deploystrategy-dev": "symlink", @@ -92,18 +104,7 @@ "openmage/dev-translations": "copy", "openmage/legacy-frontend-themes": "copy" }, - "magento-force": true, - "patches": { - "shardj/zf1-future": { - "MAG-1.1.1": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/MAG-1.1.1.patch", - "MAG-1.9.3.0": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/MAG-1.9.3.0.patch", - "MAG-1.9.3.7 - SUPEE-10415": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/MAG-1.9.3.7.patch", - "OM-918 - Add runtime cache to Zend_Locale_Data": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/OM-918.patch", - "OM-1081 - Not detecting HTTPS behind a proxy": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/OM-1081.patch", - "OM-2047 - Pass delimiter char to preg_quote": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/OM-2047.patch", - "OM-2050 - Prevent checking known date codes": "https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/OM-2050.patch" - } - } + "magento-force": true }, "config": { "allow-plugins": { @@ -116,4 +117,4 @@ }, "sort-packages": true } -} +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index 5b2125295fd..2a0ac7ecf87 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7fa4970f47693e04c0b769ceb76a9a9c", + "content-hash": "0fb17c620d101b76c30e6ab957fc14b7", "packages": [ { "name": "colinmollenhour/cache-backend-redis", From 18456fb526e7d644f1863cbdf6a1e1611a811e77 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 05:59:06 +0100 Subject: [PATCH 14/16] Removed mkdocs again --- .github/workflows/docs.yml | 36 ----------- mkdocs.yml | 123 ------------------------------------- 2 files changed, 159 deletions(-) delete mode 100644 .github/workflows/docs.yml delete mode 100644 mkdocs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 12a7c9b8d33..00000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: MkDocs - -on: - workflow_call: - # Allow manually triggering the workflow. - workflow_dispatch: - - push: - branches: - - main - - documentation - paths: - - 'docs/**.md' - - 'mkdocs.yml' -permissions: - contents: write -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: 3.x - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - - uses: actions/cache@v3 - with: - key: mkdocs-material-${{ env.cache_id }} - path: .cache - restore-keys: | - mkdocs-material- - - run: pip3 install mkdocs mkdocs-material mkdocs-minify-plugin mkdocs-redirects - - - name: Publish docs - run: mkdocs gh-deploy --force diff --git a/mkdocs.yml b/mkdocs.yml deleted file mode 100644 index 82bf01e038c..00000000000 --- a/mkdocs.yml +++ /dev/null @@ -1,123 +0,0 @@ -# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json -site_name: OpenMage Docs -site_url: https://github.readthedocs.io/en/latest/ -repo_url: https://github.com/OpenMage/magento-lts -repo_name: OpenMage/magento-lts -edit_uri: blob/main/docs/content -copyright: OpenMage contributors -site_author: OpenMage contributors -site_description: >- - Magento - Long Term Support. -docs_dir: docs/content - -# Configuration -theme: - name: material - custom_dir: docs/overrides - palette: - - scheme: default - primary: deep purple - accent: deep purple - features: - - content.code.copy - - navigation.expand - - navigation.indexes - - navigation.instant - - navigation.sections - - navigation.tabs - - navigation.top - - navigation.tracking - -# Plugins -plugins: - - search - - redirects: - redirect_maps: - - minify: - minify_html: true - -# Customization -extra: - social: - - icon: fontawesome/brands/github - link: https://github.com/OpenMage/magento-lts - - icon: fontawesome/brands/discord - link: https://discord.gg/EV8aNbU - - icon: fontawesome/brands/stack-overflow - link: https://magento.stackexchange.com/tags/openmage - - icon: fontawesome/brands/twitter - link: https://twitter.com/openmageproject - generator: false - -# Extensions -markdown_extensions: - - abbr - - admonition - - attr_list - - def_list - - footnotes - - meta - - md_in_html - - toc: - permalink: true - toc_depth: 2 - - pymdownx.arithmatex: - generic: true - - pymdownx.betterem: - smart_enable: all - - pymdownx.caret - - pymdownx.details - - pymdownx.highlight: - anchor_linenums: true - - pymdownx.inlinehilite - - pymdownx.keys - - pymdownx.magiclink: - repo_url_shorthand: true - user: OpenMage - repo: magento-lts - - pymdownx.mark - - pymdownx.smartsymbols - - pymdownx.superfences: - - pymdownx.tabbed: - alternate_style: true - - pymdownx.tasklist: - custom_checkbox: true - - pymdownx.tilde - - smarty - -nav: - - 'Get started': - - index.md - - users/requirements.md - - 'Installing': - - users/install/index.md - - users/install/use-composer.md - - users/install/use-git.md - - users/install/use-tarball.md - - users/install/secure-install.md - - 'Changelog': - - developers/changelog/index.md - - developers/changelog/new-config.md - - developers/changelog/new-events.md - - developers/changelog/soap-wsdl.md - - 'Versioning': - - users/versioning/index.md - - users/versioning/maintained.md - - 'Modules': - - users/modules/index.md - - users/modules/payment.md - - users/modules/themes.md - - users/modules/more.md - - 'Development': - - 'Events': - - developers/events/observer.md - - developers/events/list.md - - 'Tools': - - developers/ddev.md - - developers/phpstorm.md - - 'Multistore': - - developers/error-pages.md - - 'Documentation': - - developers/mkdocs.md - - 'Guides': - - developers/guides/add-dynamic-block-contents-in-category-page.md From d880bccf9fb382856277465206604d70e952ab8f Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 06:19:42 +0100 Subject: [PATCH 15/16] Changed assert() to instanceof --- app/code/core/Mage/Admin/Model/Resource/Acl.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/core/Mage/Admin/Model/Resource/Acl.php b/app/code/core/Mage/Admin/Model/Resource/Acl.php index 21c2ab538f9..984d2b3d30a 100644 --- a/app/code/core/Mage/Admin/Model/Resource/Acl.php +++ b/app/code/core/Mage/Admin/Model/Resource/Acl.php @@ -122,8 +122,7 @@ public function loadRules(Mage_Admin_Model_Acl $acl, array $rulesArr) $assert = null; if ($rule['assert_id'] !== '0') { $assertType = Mage::getSingleton('admin/config')->getAclAssert($rule['assert_type']); - if ($assertType) { - assert($assertType instanceof Mage_Core_Model_Config_Element); + if ($assertType instanceof Mage_Core_Model_Config_Element) { $assertClass = $assertType->getClassName(); $assert = new $assertClass(unserialize($rule['assert_data'], ['allowed_classes' => false])); } From 3526ded83a7a97347446bb59d0e2b15716b6f248 Mon Sep 17 00:00:00 2001 From: Sven Reichel Date: Sat, 18 Nov 2023 06:33:32 +0100 Subject: [PATCH 16/16] Fixed EOL --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 53e0319c2e2..9f900679c6d 100644 --- a/composer.json +++ b/composer.json @@ -117,4 +117,4 @@ }, "sort-packages": true } -} \ No newline at end of file +}