We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8694
    • 61 Posts
    Hi,

    after the update of getResources I get en error when I view the website.
    The Website works well but on top it shows me the following message:
    [2010-08-04 17:24:21] (ERROR @ /index.php) `id` is not a valid integer and may not be passed to makeUrl() [2010-08-04 17:24:21] (ERROR @ /index.php) `id` is not a valid integer and may not be passed to makeUrl() [2010-08-04 17:24:21] (ERROR @ /index.php) `id` is not a valid integer and may not be passed to makeUrl() [2010-08-04 17:24:21] (ERROR @ /index.php) `id` is not a valid integer and may not be passed to makeUrl() [2010-08-04 17:24:21] (ERROR @ /index.php) `id` is not a valid integer and may not be passed to makeUrl() 


    What can it be?
      • 8694
      • 61 Posts
      Hi guys,

      any idea?
        • 8694
        • 61 Posts
        The Problem ist still there!

        I got 2 contexts in my Site.
        The error apear only in the first (web) context. The second one works well.
        That is a little bit funny. What can it be???
          • 24446
          • 1 Posts
          Hi elegato

          I had the same problem and found a solution...

          open the modx class file
          (it can be found under mysite\core\model\modx\modx.class.php)

          goto the makeUrl() function (use an text editor, search for `makeUrl(` )
          the end of the makeUrl() function looks like:
              } else {
                  $this->log(modX::LOG_LEVEL_ERROR, '`' . $id . '` is not a valid integer and may not be passed to makeUrl()');
              }
              return $url;
          }
          


          use a try..catch to produce a stack trace in the MODx log:
          (maybe you want to create a backup of this modx.class.php file before updating it ... your choice)
              } else {
                  $this->log(modX::LOG_LEVEL_ERROR, '`' . $id . '` is not a valid integer and may not be passed to makeUrl()');
                  /*** print the stack trace to the MODx log ***/
                  try {
                      throw new Exception('catch this...');
                  }
                  catch (Exception $e) {
                      $this->log(modX::LOG_LEVEL_ERROR, $e->getTraceAsString());
                  }
                  /*********************************************/
              }
              return $url;
          }
          


          save the modification to the MODx class and do whatever it needs to reproduce the error.
          open the MODx log. it now contains a stack trace that you can use to track down the error.
          do not forget to undo the modification in the modx.class.php after fixing the error.

          here’s an example
          [2010-11-17 22:30:39] (ERROR @ /index.php) `[[+id]]` is not a valid integer and may not be passed to makeUrl()
          [2010-11-17 22:30:39] (ERROR @ /index.php)
          #0 <your_site_root>htdocs\core\model\modx\modparser.class.php(955): modX->makeUrl('[[+id]]', '', '', -1)
          #1 <your_site_root>htdocs\core\model\modx\modparser.class.php(379): modLinkTag->process(NULL)
          #2 <your_site_root>htdocs\core\model\modx\modparser.class.php(165): modParser->processTag(Array, false)
          #3 <your_site_root>htdocs\core\model\modx\modchunk.class.php(93): modParser->processElementTags('[[$ysp.login_pa...', '<div class="ysp...', false, false, '[[', ']]', Array, 10)
          #4 <your_site_root>htdocs\core\model\modx\modx.class.php(1558): modChunk->process(Array)
          #5 <your_site_root>htdocs\core\components\login\model\login\login.class.php(165): modX->getChunk('ysp.login_panel...', Array)
          #6 <your_site_root>htdocs\core\cache\elements\modsnippet\2.include.cache.php(289): Login->getChunk('ysp.login_panel...', Array, 'modChunk')
          #7 <your_site_root>htdocs\core\model\modx\modscript.class.php(48): elements_modsnippet_2(Array)
          #8 <your_site_root>htdocs\core\model\modx\modx.class.php(1528): modScript->process(Array)
          #9 <your_site_root>htdocs\core\components\mycp\elements\ysplogin.snippet.php(12): modX->runSnippet('Login', Array)
          #10 <your_site_root>htdocs\core\cache\elements\modsnippet\24.include.cache.php(7): include('...')
          #11 <your_site_root>htdocs\core\model\modx\modscript.class.php(48): elements_modsnippet_24(Array)
          #12 <your_site_root>htdocs\core\model\modx\modparser.class.php(416): modScript->process(NULL)
          #13 <your_site_root>htdocs\core\model\modx\modparser.class.php(165): modParser->processTag(Array, true)
          #14 <your_site_root>htdocs\core\model\modx\modresponse.class.php(63): modParser->processElementTags('', '<!--? *? * defa...', true, false, '[[', ']]', Array, 10)
          #15 <your_site_root>htdocs\core\model\modx\modrequest.class.php(110): modResponse->outputContent(Array)
          #16 <your_site_root>htdocs\core\model\modx\modx.class.php(815): modRequest->prepareResponse()
          #17 <your_site_root>htdocs\core\model\modx\modx.class.php(852): modX->sendForward('1', Array)
          #18 <your_site_root>htdocs\core\model\modx\modrequest.class.php(146): modX->sendErrorPage()
          #19 <your_site_root>htdocs\core\model\modx\modrequest.class.php(88): modRequest->getResource('id', 'favicon.ico')
          #20 <your_site_root>htdocs\core\model\modx\modx.class.php(1072): modRequest->handleRequest()
          #21 <your_site_root>htdocs\index.php(93): modX->handleRequest()
          #22 {main}
          



          item #0 contains the bad makeUrl() call that is causing the error.
          the next item that processes a custom MODx element is item #3:
          modParser->processElementTags('[[$ysp.login_page_form]]', '<d...
          


          in this example, the [[$ysp.login_page_form]] Chunk contains the following code:
          ...
          <form name="login-panel-form" method="post" action="[[~[[+id]]]]">
          ...
          


          the error is caused by [[~[[+id]]]]. changing it to [[~[[*id]]]] solves the problem.



          Good luck!

          Ramon

          PS: No guarantees for the code at all. DO NOT apply this on production sites...
            • 12491
            • 90 Posts
            Got a simular problem,

            Can you tell me where the fould lies here?

            thnx
            Hurby

            [2011-08-19 14:28:15] (ERROR @ /index.php) `id` is not a valid integer and may not be passed to makeUrl()
            [2011-08-19 14:28:15] (ERROR @ /index.php) #0 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(1025): modX->makeUrl(’id’, ’’, ’’, ’-1’)
            #1 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(400): modLinkTag->process(NULL)
            #2 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(186): modParser->processTag(Array, true)
            #3 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(354): modParser->processElementTags(’[[[[~id]]]]’, ’[[~id]]’, true)
            #4 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(186): modParser->processTag(Array, true)
            #5 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(354): modParser->processElementTags(’[[!MetaX??&allk...’, ’!MetaX??&allkey...’, true)
            #6 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(186): modParser->processTag(Array, true)
            #7 /var/www/clients/client3/web146/web/core/model/modx/modresponse.class.php(61): modParser->processElementTags(’’, ’<!doctype html>...’, true, false, ’[[’, ’]]’, Array, 10)
            #8 /var/www/clients/client3/web146/web/core/model/modx/modrequest.class.php(110): modResponse->outputContent(Array)
            #9 /var/www/clients/client3/web146/web/core/model/modx/modrequest.class.php(94): modRequest->prepareResponse()
            #10 /var/www/clients/client3/web146/web/core/model/modx/modx.class.php(1161): modRequest->handleRequest()
            #11 /var/www/clients/client3/web146/web/index.php(81): modX->handleRequest()
            #12 {main}
            [2011-08-19 14:28:15] (ERROR @ /index.php) `id` is not a valid integer and may not be passed to makeUrl()
            [2011-08-19 14:28:15] (ERROR @ /index.php) #0 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(1025): modX->makeUrl(’id’, ’’, ’’, ’-1’)
            #1 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(400): modLinkTag->process(NULL)
            #2 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(186): modParser->processTag(Array, true)
            #3 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(354): modParser->processElementTags(’[[[[~id]]]]’, ’[[~id]]’, true)
            #4 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(186): modParser->processTag(Array, true)
            #5 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(354): modParser->processElementTags(’[[!MetaX??&allk...’, ’!MetaX??&allkey...’, true)
            #6 /var/www/clients/client3/web146/web/core/model/modx/modparser.class.php(186): modParser->processTag(Array, true)
            #7 /var/www/clients/client3/web146/web/core/model/modx/modresponse.class.php(61): modParser->processElementTags(’’, ’<!doctype html>...’, true, false, ’[[’, ’]]’, Array, 10)
            #8 /var/www/clients/client3/web146/web/core/model/modx/modrequest.class.php(110): modResponse->outputContent(Array)
            #9 /var/www/clients/client3/web146/web/core/model/modx/modrequest.class.php(94): modRequest->prepareResponse()
            #10 /var/www/clients/client3/web146/web/core/model/modx/modx.class.php(1161): modRequest->handleRequest()
            #11 /var/www/clients/client3/web146/web/index.php(81): modX->handleRequest()
            #12 {main}

            the error is caused by [[~[[+id]]]]. changing it to [[~[[*id]]]] solves the problem.

            in my case changing + tot * in a tpl leads to the getresources call not finding a target anymore.

            any idea?
              Sommige mensen hebben aan een half woord genoeg
              • 22303 MODX Staff
              • 10,725 Posts
              You have a malformed tag in there according to the stack trace: [[[[~id]]]]
                • 12491
                • 90 Posts
                Thnx Ramon , Opengeek,

                Problem Solved!!
                  Sommige mensen hebben aan een half woord genoeg
                  • 40001
                  • 15 Posts
                  Hi I have exactly the same problem. Would anyone mind having a look at this catch?


                  [2012-07-13 00:10:09] (ERROR @ /index.php)
                  #0 /var/www/mysite/wwwroot/core/model/modx/modparser.class.php(1269): modX->makeUrl('[[+id]]', '', '', '-1', Array)
                  #1 /var/www/mysite/wwwroot/core/model/modx/modparser.class.php(447): modLinkTag->process(NULL)
                  #2 /var/www/mysite/wwwroot/core/model/modx/modparser.class.php(221): modParser->processTag(Array, false)
                  #3 /var/www/mysite/wwwroot/core/model/modx/modchunk.class.php(118): modParser->processElementTags('[[$list-wallpap...', '<div id="innerB...', false, false, '[[', ']]', Array, 10)
                  #4 /var/www/mysite/wwwroot/core/model/modx/modparser.class.php(455): modChunk->process(NULL)
                  #5 /var/www/mysite/wwwroot/core/model/modx/modparser.class.php(221): modParser->processTag(Array, false)
                  #6 /var/www/mysite/wwwroot/core/model/modx/modtemplate.class.php(120): modParser->processElementTags('[[]]', '[[$head?]]??<bo...', false, false, '[[', ']]', Array, 10)
                  #7 /var/www/mysite/wwwroot/core/model/modx/modresource.class.php(318): modTemplate->process()
                  #8 /var/www/mysite/wwwroot/core/model/modx/modresponse.class.php(75): modResource->process()
                  #9 /var/www/mysite/wwwroot/core/model/modx/modrequest.class.php(144): modResponse->outputContent(Array)
                  #10 /var/www/mysite/wwwroot/core/model/modx/modrequest.class.php(128): modRequest->prepareResponse()
                  #11 /var/www/mysite/wwwroot/core/model/modx/modx.class.php(1299): modRequest->handleRequest()
                  #12 /var/www/mysite/wwwroot/index.php(72): modX->handleRequest()
                  #13 {main}
                  [2012-07-13 00:10:09] (ERROR @ /index.php) `[[+id]]` is not a valid integer and may not be passed to makeUrl()
                  
                  

                    • 38076
                    • 15 Posts
                    @radar24

                    It seems your problem is caused in a chunk called $list-wallpap... (the full name doesn't appear above but I'm sure you know which is meant).

                    Somewhere in that chunk a link is generated that causes makeUrl to produce the error. See my next comment for more detail.
                      • 38076
                      • 15 Posts
                      I have had the same problem and thanks to this thread and some digging I’ve found a solution and also what might be the cause for many people here.

                      The problem is that generating URLs is typically done using tags like
                       [[*id]]
                      which is what makeUrl is expecting. However, when using TPL chunks for snippets like getResources, you must refer to the page URL with
                       [[+id]]
                      or getResources will only return the link to the page on which it was called and not the pages that you want to list.

                      makeUrl still seems to handle it fine only it triggers our favorite error message. Here is what I did to get rid of that error message:

                      After identifying the place where makeUrl goes sour about life (thanks to ramonb’s bag of tricks above), I bypassed makeUrl to generate the URL with another tag:

                      in the call that makeUrl hates, the URL was generated with this code:
                      <a href=``[[~[[+id]]]]``>[[+pagetitle]]</a>


                      (note I had to use two back ticks otherwise the forum would have done strange things)

                      Instead I replaced
                       [[~[[+id]]]] 

                      with
                      www.mysite.com/[[+alias]] 
                      tag to generate the URL manually.

                      That way you can still generate the URL dynamically but without using makeUrl. I realize this is more of a work around than a solution since not everybody has their URLs structured in this way.

                      May I humbly suggest to fix this with a future patch? Since makeUrl clearly hanldles the
                      [[+id]]
                      fine but only likes to kick up a fuss about it, I’m guessing with my limited knowledge that it can’t be a huge problem to solve.

                      [ed. note: adi778 last edited this post 14 years, 1 month ago.]