Fehler: STRPOS not working on rocksolid variable - also wrong strlen

Tobias Jerg's Avatar

Tobias Jerg

27 Aug, 2018 09:31 AM

Produkt: Custom Elements Contao
Contao-Version: 4.4.21

Hello,
we are experiencing a weird behaviour when trying to use strpos on a rocksolid variable
DCA: 'linkurl' => array('label' => array('Link to Page', ''),'inputType' => 'url','eval' => array('tl_class' => 'w50'),),

strlen($this->linkurl) will output a higher number of characters than the strin contains and also a simple if(strpos($this->linkurl, ':') !== FALSE){ will always result in FALSE while with hardcoded variables like $url=" I contain :"; vs $url2 = "without colon"; it will work as expected.

Do you have any idea why it is like that or do I have to wrap a function around the variable to convert it?

Many thanks in advance
Tobias

  1. Support Staff 1 Posted by RockSolid Theme... on 27 Aug, 2018 03:28 PM

    RockSolid Themes's Avatar

    Thank you for submitting your question!

    Are you using an insert tag as URL (like {{link_url::…}})? If so, the strlen() function will give you the length of the insert tag instead of the URL length.

    If you don’t use an insert tag, please take a look at the database table tl_content and post here what’s in the rsce_data column of the affected element.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac