Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required Text #1

Open
katgirl opened this issue Aug 11, 2023 · 4 comments
Open

Required Text #1

katgirl opened this issue Aug 11, 2023 · 4 comments

Comments

@katgirl
Copy link

katgirl commented Aug 11, 2023

If you set only a background image, an error occurs because a text is expected.
https://github.com/nutshell-framework/hero-element/blob/develop/src/Content/Hero.php#L95

Either you would make the text field mandatory or rule in the code if no text is sent.

request.CRITICAL: Uncaught PHP Exception TypeError: "str_replace(): Argument #3 ($subject) must be of type array|string, null given" at /var/customers/webs/inszenium/xxx.inszenium.cloud/vendor/nutshell-framework/hero-element/src/Content/Hero.php line 95 {"exception":"[object] (TypeError(code: 0): str_replace(): Argument #3 ($subject) must be of type array|string, null given at /var/customers/webs/inszenium/xxx.inszenium.cloud/vendor/nutshell-framework/hero-element/src/Content/Hero.php:95)"} []
@denniserdmann
Copy link
Contributor

I can see a potential problem here, but i cannot reproduce this error.

Contao: 4.13.30 / 5.2.2 (APP_ENV=dev)
PHP 8.2

@stefansl
Copy link

stefansl commented Mar 19, 2024

Hi Dennis, I can confirm this. Same error here. If no text is given, you will run into an error.

$this->text = str_replace(' src="' . $path, ' src="' . $staticUrl . $path, $this->text);

Contao: 5.3
PHP: 8.3

@denniserdmann
Copy link
Contributor

@katgirl @stefansl which version of hero-element do you use?

As $this->text ist indeed mandatory (contao default), i'm wondering how you run into that error.

denniserdmann added a commit that referenced this issue Apr 3, 2024
add container only when headline or text is given, closes #1
@denniserdmann
Copy link
Contributor

Update: problem found an solved in 1.2.2.

You both set a files url in website root, didn't you? I tested it with a subdomain and removed text directly in database, so i could get your problem. I now added an additional condition to check for $this->text.

Please test Version 1.2.2 and give feddback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants