-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Cannot use object of type Closure as array #17
Comments
I don't think this error is due to our StripTags filter. To verify, I wrote the following test method, which I placed in our public function testConstructorWorksWithoutErrors()
{
$html = <<< 'END'
<p>
<span>This is some <a href="https://getlaminas.org">text with a link</a></span>
</p>
END;
$expected = <<< 'END'
<p>
This is some <a href="https://getlaminas.org">text with a link</a>
</p>
END;
$allowedElements = [
'allowTags' => [
'ul','li','ol','br','p','b','strong','i','em','h1','h2','h3','h4','h5','a'
],
'allowAttribs' => [
'href'
]
];
$filter = new StripTagsFilter($allowedElements);
$this->assertSame($expected, $filter->filter($html));
} This test passes as-is currently. Looking in your write-up, the error message indicates the problem is in |
Apologies for the delay in response. COVID threw everything out the window. Anyway, I'm still having an issue. Once I installed Laminas via composer require, I get that error about AddonLoader. So, to fix it I had rename the vendor folder, and copy the previous backup of the vendor folder in (without Laminas in it). Error goes away. So then I copied in just the Laminas folder from the renamed vendor folder. I did composer dump-autoload too hoping to make sure that it would rebuild the autoloader and possibly include Laminas. I attempted to run my script. I now get an error that StripTags does not exist. I attempted to install it locally in the same repo (instead of on the server) and I get a problem installing it:
My PHP ini file is set to 1GB of memory_limit so this really shouldn't be happening. |
A bit more testing here... I found some help about using "COMPOSER_MEMORY_LIMIT=-1" before running composer require. This fixed the problem with installing but immediately after installing ONLY Luminas I again get the AddonLoader error. I'm going to try building a new default Laravel instance and add Luminas to it and turn it into a service. |
Bug Report
When attempting to instantiate Laminas Filter I'm getting an error about the Closure as array.
Current behavior
Getting the following error:
How to reproduce
Added laminas filter to my laravel project using composer.
Added
use Laminas\Filter\StripTags;
to my controller.I then applied the following code to my method:
Expected behavior
Should result in a string for $htmltext.
The text was updated successfully, but these errors were encountered: