Bug #87689

Different behavior with different database drivers

Added by Dirk Heyka 4 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Must have
Category:
SEO
Target version:
-
Start date:
2019-02-11
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I found a bug in the EXT:seo. When I use the database-driver pdo_mysql all resulted fields will be strings. I found this error while I was trying to make a sitemap.xml with more sitemaps (for an own extension e.g.).

So I debugged in RecordsXmlSitemapDataProvider->generateItems and there were all fields strings (uid, pid, tstamp, crdate, etc.).

When I change the database-driver to mysqli everything works fine and all said fields have the right types (here int)
The type/default value for uid, pid, tstamp, crdate, etc. fields in the tx_products_domain_model_product table is integer.

The TypoScript for the Sitemap:

plugin.tx_seo {
    config {
        xmlSitemap {
            sitemaps {
                products {
                    provider = TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider
                    config {
                        table = tx_products_domain_model_product
                        sortField = title
                        lastModifiedField = tstamp
                        pid = 2
                        recursive = 2
                        url {
                            pageId = 4
                            fieldToParameterMap {
                                uid = tx_products_products[product]
                            }
                            additionalGetParameters {
                                tx_products_products.controller = Product
                                tx_products_products.action = show
                            }
                            useCacheHash = 1
                        }
                    }
                }
            }
        }
    }
}

The Sitemap-Config:

routeEnhancers:
  PageTypeSuffix:
    type: PageType
    map:
       sitemap.xml: 1533906435

When I use pdo_mysql, I'll become an error-message: TypeError: Return value of TYPO3\CMS\Seo\XmlSitemap\AbstractXmlSitemapDataProvider::getLastModified() must be of the type integer, string returned.

Debug with pdo_mysql driver:
Debug with pdo_mysql driver

Debug with mysqli driver:
Debug with mysqli driver

P.S. I discussed that problem with Richard Haeser before. He said, that I should assign this ticket to him.

mysqli.png View - Debug with mysqli driver (54.4 KB) Dirk Heyka, 2019-02-11 15:00

debug_pdo.png View - Debug with pdo_mysql driver (74.3 KB) Dirk Heyka, 2019-02-11 15:00

Associated revisions

Revision c939678b (diff)
Added by Richard Haeser 4 months ago

[BUGFIX] Cast lastMod property to int

To prevent type mismatches when using pdo_mysql as the database driver,
the data for the lastMod field is cast to an integer.

Resolves: #87689
Releases: master, 9.5
Change-Id: I696f62a3b08d464708c9e1ab9edb4c733835f475
Reviewed-on: https://review.typo3.org/59682
Reviewed-by: Oliver Klee <>
Tested-by: TYPO3com <>
Reviewed-by: Björn Jacob <>
Reviewed-by: Guido Schmechel <>
Reviewed-by: André Schließer <>
Reviewed-by: Jörg Bösche <>
Reviewed-by: Josef Glatz <>
Tested-by: Josef Glatz <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>

Revision 1ee70ea9 (diff)
Added by Richard Haeser 4 months ago

[BUGFIX] Cast lastMod property to int

To prevent type mismatches when using pdo_mysql as the database driver,
the data for the lastMod field is cast to an integer.

Resolves: #87689
Releases: master, 9.5
Change-Id: I696f62a3b08d464708c9e1ab9edb4c733835f475
Reviewed-on: https://review.typo3.org/59687
Tested-by: TYPO3com <>
Reviewed-by: Georg Ringer <>
Tested-by: Georg Ringer <>

History

#1 Updated by Gerrit Code Review 4 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59682

#2 Updated by Gerrit Code Review 4 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59682

#3 Updated by Gerrit Code Review 4 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59682

#4 Updated by Gerrit Code Review 4 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59687

#5 Updated by Richard Haeser 4 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#6 Updated by Benni Mack about 2 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF