Ecodev / newsletter

TYPO3 extension to send newsletter

Home Page:https://extensions.typo3.org/extension/newsletter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

404, 500 and wrong links when multiple domains

opened this issue · comments

Hi
I install the newsletter 2.6.1 this morning but the statistiques doesn't woks anymore.

If I check the "Detect opened emails" box the image src in the bottom of the newsletter is src="http://www.domain.fr/lettre-dinformation-578/?tx_newsletter_p%5Bc%5D=9494fd08fe9de8c200542b867c77f7cc&tx_newsletter_p%5Baction%5D=opened&tx_newsletter_p%5Bcontroller%5D=Email" but the image is not found

If I check the "Detect clicked links:" box, the links are encrypt but when I click on a link, I'm redirect on the website home page.

Regards.
Thomas

How many domains exist in this TYPO3 install ? What are the PID of all your roots ? and finally could you try to edit Classes/Utility/UriBuilder.php the getUriBuilder() method, so that it would read:

    private static function getUriBuilder($currentPid)
    {
        $currentPid = 0; // <= Try 0 first, and then 1, and then all of your root PID
        if (!isset(self::$uriBuilder[$currentPid])) {
    ...

And let me know if that would fix your case...

There are 3 websites on this TYPO6 instace
id 1 : 2 domains
id 7433 : 1 domain
id 5804 : 2 domains

With $currentPid = 0; I can edit recipient list but no improvements for the statistics.
Idem with $currentPid = 1

So that confirm my doubts. The problem is that the UriBuilder cannot properly build frontend URI when there are several domains. Unfortunately, I don't really know how to fix it. I spend a whole day on that already (see 530094b), and it worked in my test cases. But it seems that it still doesn't work for all cases. I am afraid, I won't be able to help you much, and you'll have to debug it on your own installation. Going deep in TYPO3 core code you should find out why the link is not properly built. It's probably because the fake TSFE is not built properly or we give wrong/missing parameters to build the link.

On a side note, you have multiple domains for a single root ?

Ok
I'll ask a collegue to look at this problem.
Here is a caption from my page tree :
capture

Thanks for your help, I let you know if we find a solution

If this can help, I got this error when I look at the stats

DBAL fatal error: No handler found in handler_getFromTableList() for: "tx_newsletter_domain_model_link LEFT JOIN tx_newsletter_domain_model_linkopened ON (tx_newsletter_domain_model_linkopened.link = tx_newsletter_domain_model_link.uid)" (SQL engine parse ERROR: No join field found in parseFromTables()!: near "(tx_newsletter_domain_model_linkopened.link = tx_n")

Hi,
My collegue found the (strange?) solution : to use a numtype with less character.
Can you change it ? Or can you put it in a constant ?

What is a PR ?
"Also could you find why having less character fix it ?" -> My collegue took a look but found nothing.

A Pull Request, PR, is the GitHub way to submit patches, have a look at their docs.

Ok, I'll do a pr.
The problem is in the TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder class: setTargetPageType:

$this->targetPageType = (int)$targetPageType;

the (int) value depend on system
9 character typenum isn't a safe choice, apparently

Hello, I have a similar problem: after install of newsletter extension, I get a 404 (my custom error page) on every click on a sysfolder or redirect page (when in newsletter mode). I have NO domain records set. (In fact, I had one, but I deleted it upon finding this issue, no change).
The same happens when I try to edit a recipient list in list mode. Creation: 404 happens here too, but the list is created. Only editing afterwards is impossible.
PHP: 5.5.30 (tried with 5.6.12), T3: 7.6.5

@thombeck, is your server 32 bits ? or 64 bits ? the following command should give you the answer:

php -i | grep -E '(System|Host) =>'

@brackindustries, the problem you describe seems to be a duplicate of #98 and is solved in develop branch.

@thombeck, 32 bits system maximum integer value is 2'147'483'647 (as confirmed by PHP doc). And Newsletter typenum is actually the unix timestamp (by definition a 32 bit integer) of when I created it back in 2012, that is 1'342'671'779. As you can see it is (much) lower than the maximum. Also the official TYPO3 doc confirms that typenum is an integer (I don't know what else it could have been). So even if you had a 32 bit system (which is getting less common nowadays), it couldn't be a problem.

All of that to say that the suggestion to change typenum value is very suspicious. And changing it would be a breaking change for all Newsletter installation because it would break links for all emails sent. And I think something else is going on in your system. As a proof could you modify the code you mentioned earlier (TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::setTargetPageType()) to be the following and let me know the output, please:

$this->targetPageType = (int)$targetPageType;
if ($targetPageType == 1342671779) { 
    var_dump($targetPageType, $this->targetPageType);
    die();
}

Also you mentioned a DBAL fatal error. What kind of database setup do you use ? is it not the vanilla MySQL ?

It seems there are many unclear things about this issue, and that makes it a bit confusing and hard to work on. I'll close it for now. But feel free to re-open new, separated issues with clear description for each problems you encounter. I am sure we'll be able to work things out if we focus on one problem at a time.