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

Update for setImageValue() inside clonedBlock with indexed values #1624

Closed
1 task done
Amerlander opened this issue May 1, 2019 · 1 comment
Closed
1 task done

Comments

@Amerlander
Copy link

Amerlander commented May 1, 2019

This is:

  • a bug report

Expected Behavior

The cloned imagefield ${IMAGE:10cmx15cm} should return like ${IMAGE#1:10cmx15cm}

Current Behavior

Its returned like ${IMAGE:10cmx15cm#1}

Failure Information

I changed the RegularExpression in indexClonedVariables() for fixing this behaviour. It works for my purpose, but I didnt checked further:
$results[] = preg_replace('/\$\{(.*?)(:([^}])*)?\}/', '\${\\1#' . $i . '\\2}', $xmlBlock);

6a51165

Context

  • PHP version:
  • PHPWord version: 0.16.0
Amerlander referenced this issue May 5, 2019
Using the setImageValue() with image dimensions inside search pattern like ${IMAGE:10cmx15xm} inside a cloned block with indexed values where resulting in ${IMAGE:10cmx15cm#1}. This change in the RegularExpresion of the indexClonedVariables() is changing it to ${IMAGE#1:10cmx15cm} instead.
getVariables() will still return the whole pattern, "IMAGE#1:10cmx15cm", maybe it should also be updated to just return the raw field name "IMAGE#1".
Amerlander added a commit to Amerlander/PHPWord that referenced this issue Feb 25, 2020
If an image field like `${IMAGE:10cmx15cm}` gets cloned it returns now `${IMAGE#1:10cmx15cm}` instead of `${IMAGE:10cmx15cm#1} and therefore wouldn't break the image field anymore.

Closes PHPOffice#1624
@Amerlander
Copy link
Author

fixed by #1763

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

Successfully merging a pull request may close this issue.

1 participant