Announcement

Collapse
No announcement yet.

Error on Version 4.8.4

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error on Version 4.8.4

    When I upgrade to 4.8.4 I have this error when saving an entity new record

    Code:
    ^[
    [2017-11-14 16:56:00] Espo.WARNING: E_WARNING: array_diff(): Argument #1 is not an array {"code":2,"message":"array_diff(): Argument #1 is not an array","file":"/var/www/espo/application/Espo/Core/HookManager.php","line":171,"context":{"hookDirs":["custom/Espo/Custom/Hooks"],"hookData":{"AccountOpening":{"afterSave":{"9":["\\Espo\\Custom\\Hooks\\AccountOpening\\AccountOpening"]}}},"hookDir":"custom/Espo/Custom/Hooks","fileList":{"AccountOpening":["AccountOpening.php","MissingHandler.php"],"CashTransfers":["CashTransfers.php"],"Document":["Document.php"],"0":"MissingHandler.php","WorkLog":["WorkLog.php"]},"hookFiles":["AccountOpening.php","MissingHandler.php"],"scopeName":"AccountOpening","hookScopeDirPath":"custom/Espo/Custom/Hooks/AccountOpening","normalizedScopeName":"AccountOpening","scopeHooks":[],"hookFile":"MissingHandler.php","hookFilePath":"custom/Espo/Custom/Hooks/AccountOpening/MissingHandler.php","className":"\\Espo\\Custom\\Hooks\\AccountOpening\\MissingHandler","classMethods":null,"hookMethods":["afterSave"],"hookName":"afterSave","entityHookData":[]}} []
    [2017-11-14 16:56:00] Espo.WARNING: E_WARNING: Invalid argument supplied for foreach() {"code":2,"message":"Invalid argument supplied for foreach()","file":"/var/www/espo/application/Espo/Core/HookManager.php","line":173,"context":{"hookDirs":["custom/Espo/Custom/Hooks"],"hookData":{"AccountOpening":{"afterSave":{"9":["\\Espo\\Custom\\Hooks\\AccountOpening\\AccountOpening"]}}},"hookDir":"custom/Espo/Custom/Hooks","fileList":{"AccountOpening":["AccountOpening.php","MissingHandler.php"],"CashTransfers":["CashTransfers.php"],"Document":["Document.php"],"0":"MissingHandler.php","WorkLog":["WorkLog.php"]},"hookFiles":["AccountOpening.php","MissingHandler.php"],"scopeName":"AccountOpening","hookScopeDirPath":"custom/Espo/Custom/Hooks/AccountOpening","normalizedScopeName":"AccountOpening","scopeHooks":[],"hookFile":"MissingHandler.php","hookFilePath":"custom/Espo/Custom/Hooks/AccountOpening/MissingHandler.php","className":"\\Espo\\Custom\\Hooks\\AccountOpening\\MissingHandler","classMethods":null,"hookMethods":null,"hookName":"afterSave","entityHookData":[]}} []
    [2017-11-14 16:56:00] Espo.WARNING: E_WARNING: Invalid argument supplied for foreach() {"code":2,"message":"Invalid argument supplied for foreach()","file":"/var/www/espo/application/Espo/Core/HookManager.php","line":166,"context":{"hookDirs":["custom/Espo/Custom/Hooks"],"hookData":{"AccountOpening":{"afterSave":{"9":["\\Espo\\Custom\\Hooks\\AccountOpening\\AccountOpening"]}},"CashTransfers":{"afterSave":{"9":["\\Espo\\Custom\\Hooks\\CashTransfers\\CashTransfers"]}},"Document":{"afterSave":{"9":["\\Espo\\Custom\\Hooks\\Document\\Document"]},"returnChildrenAccountOpening":{"9":["\\Espo\\Custom\\Hooks\\Document\\Document"]},"relateToDocument":{"9":["\\Espo\\Custom\\Hooks\\Document\\Document"]}}},"hookDir":"custom/Espo/Custom/Hooks","fileList":{"AccountOpening":["AccountOpening.php","MissingHandler.php"],"CashTransfers":["CashTransfers.php"],"Document":["Document.php"],"0":"MissingHandler.php","WorkLog":["WorkLog.php"]},"hookFiles":"MissingHandler.php","scopeName":0,"hookScopeDirPath":"custom/Espo/Custom/Hooks","normalizedScopeName":"Case","scopeHooks":[],"hookFile":"Document.php","hookFilePath":"custom/Espo/Custom/Hooks/Document/Document.php","className":"\\Espo\\Custom\\Hooks\\Document\\Document","classMethods":["afterSave","returnChildrenAccountOpening","relateToDocument","__construct","getDependencyList","inject"],"hookMethods":["afterSave","returnChildrenAccountOpening","relateToDocument"],"hookName":"relateToDocument","entityHookData":[]}} []
    [2017-11-14 16:56:00] Espo.WARNING: E_WARNING: Declaration of Espo\Modules\Advanced\Core\Workflow\Conditions\Equals::compareComplex($entity, $condition) should be compatible with Espo\Modules\Advanced\Core\Workflow\Conditions\Base::compareComplex() {"code":2,"message":"Declaration of Espo\\Modules\\Advanced\\Core\\Workflow\\Conditions\\Equals::compareComplex($entity, $condition) should be compatible with Espo\\Modules\\Advanced\\Core\\Workflow\\Conditions\\Base::compareComplex()","file":"/var/www/espo/application/Espo/Modules/Advanced/Core/Workflow/Conditions/Equals.php","line":0,"context":{"file":"/var/www/espo/vendor/composer/../../application/Espo/Modules/Advanced/Core/Workflow/Conditions/Equals.php"}} []
    [2017-11-14 16:56:00] Espo.ERROR: Uncaught Exception TypeError: "Argument 1 passed to Espo\Core\Utils\Metadata::__construct() must be an instance of Espo\Core\Utils\File\Manager, instance of Espo\Core\Utils\Config given, called in /var/www/espo/custom/Espo/Custom/Hooks/MissingHandler.php on line 28" at /var/www/espo/application/Espo/Core/Utils/Metadata.php line 80 {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Espo\\Core\\Utils\\Metadata::__construct() must be an instance of Espo\\Core\\Utils\\File\\Manager, instance of Espo\\Core\\Utils\\Config given, called in /var/www/espo/custom/Espo/Custom/Hooks/MissingHandler.php on line 28 at /var/www/espo/application/Espo/Core/Utils/Metadata.php:80)"} []

    I've attached my Hook file, Please tanya help me find out the problem
    Attached Files

  • #2
    Hello
    Your class doesn't extend \Espo\Core\Hooks\Base.

    Comment


    • #3
      tanya I have made your recommendation, but I have another error in the log file

      Code:
      [2017-11-16 10:06:53] Espo.ERROR: Uncaught Exception TypeError: "Argument 1 passed to Espo\ORM\Repositories\RDB::unrelate() must be an instance of Espo\ORM\Entity, null given, called in /var/www/espo/custom/Espo/Custom/Hooks/MissingHandler.php on line 54" at /var/www/espo/application/Espo/ORM/Repositories/RDB.php line 316 {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Espo\\ORM\\Repositories\\RDB::unrelate() must be an instance of Espo\\ORM\\Entity, null given, called in /var/www/espo/custom/Espo/Custom/Hooks/MissingHandler.php on line 54 at /var/www/espo/application/Espo/ORM/Repositories/RDB.php:316)"} []
      I've attached the all the directory and please tanya help me.
      Attached Files

      Comment


      • #4
        You pass wrong parameter to methods, declared in application/Espo/ORM/Repositories/RDB.php
        check, what you pass in relate and unrelate methods. You can see the error reason in log

        Before file was't read. Now you see errors.

        Comment


        • #5
          Hi tanya I did what you say and the error has been disappeared, but the hook didn't run any functionalities.

          Comment


          • #6
            data/cache/application/hooks.php - here you can find the list of all hooks.
            If your hook is in the list, but doesn't do, what you want, you write the wrong code.

            Comment


            • #7
              Hi tanya I've added my hooks into this file in the path you provided and It didn't work.

              Comment


              • #8
                and this is my file
                Attached Files

                Comment


                • #9
                  you don't need to touch this file. I told you about it only for checking. After rebuild this file will be overwritten. If everything is ok, your hook has to be there.

                  Comment


                  • #10
                    tanya I didn't touch it and I have rebuilt the CRM and now the same result. The MissingDocuments Hook didn't run.

                    Comment


                    • #11
                      if your hook is not here, check if it located in the right place, has correct namespace and class name, and is readable

                      Comment


                      • #12
                        After I checked the Hooks and their right namespaces and didn't find the hooks.php file after rebuilding the application.
                        All the folder has the right permissions for all files (Reading/Writing).
                        and It didn't run yet

                        Comment


                        • #13
                          attach the file of the hook and write the path

                          Comment


                          • #14
                            The path is : /var/www/espo/data/cache/application/hooks.php
                            Attached Files

                            Comment


                            • #15
                              I asked a logic of hook, not about the cache. it seams the path is Espo/Custom/Hooks/Document/Document.php
                              afterSave hook doesn't work as well?

                              Comment

                              Working...
                              X