dmitryd / typo3-realurl

**Vintage** RealURL extension for TYPO3 CMS. Read the wiki if you have questions!
110 stars 127 forks source link

[Bug] Post hook not used in redirects #516

Closed pfaffenrodt closed 6 years ago

pfaffenrodt commented 7 years ago

We use encode/decode hooks and they are not used in all redirect usecases. For example: UrlDecoder class use the cached SpeakingUrl in checkExpiration to redirect. But those cached SpeakingUrls are not encoded by the hook.

Expected:

Visting an expired page and the new resolving url is encoded by the hook.

Reproduce:

  1. Create page entry.
  2. Visit page to create cache.
  3. Update speaking url of page entry.
  4. Visit page

realurl_config:


/*
 * Preprocessor when user requests an URL in browser
 */
function user_decodeSpURL_preProc(&$params, &$ref) {
    // decode
}
/*
 * Preprocessor when Typo3 generates a Link
 */
function user_encodeSpURL_postProc(&$params, &$ref) {
    // encode
}

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] = array(
   'encodeSpURL_postProc' => array('user_encodeSpURL_postProc'),
   'decodeSpURL_preProc' => array('user_decodeSpURL_preProc'),
   ...
   )
dmitryd commented 7 years ago

You will get that url in the hook after the redirection. Is this enough?

pfaffenrodt commented 7 years ago

If the redirected page url is encoded, then yes. That would be great.

Not after redirection. Multiple redirects would be not ok.

dmitryd commented 7 years ago

When realurl redirects from the expired url, it redirects to new encoded url.