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

Bug in SetValue() when replace contains "&" #41

Open
SeriusName opened this issue May 13, 2022 · 0 comments
Open

Bug in SetValue() when replace contains "&" #41

SeriusName opened this issue May 13, 2022 · 0 comments

Comments

@SeriusName
Copy link

When usingt setValue() for replacing a variable ${variable} containing "&" the function does not respond with any error but the document will be saved corrupted and therefore you will not be able to use or open it.

Our Solution was to replace the "&" with the xml code for that character, so'&' and then it will be correctly replaced.


$variableToSearch = 'some_variable';
$variableToReplace = 'some_variable_with_&';

//Fix & error
$variableToReplace = str_replace('&','&',variableToReplace );

$templateProcessor = new TemplateProcessor($doc_source_filename);
$templateProcessor->setValue($variableToSearch,$variableToReplace);

I hope that might help!

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

1 participant