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

fix "Undefined offset" notice in _applyGSUBrulesIndic() #1561

Open
wants to merge 2 commits into
base: development
Choose a base branch
from

Conversation

SennoYuki
Copy link

reproduce this bug

<?php
require ('./vendor/autoload.php');

$model = [];
$origin = ['user_name'=>'✿્᭄͜͡'];
$model['user_name'] = htmlspecialchars($origin['user_name']);
$mpdf = new Mpdf\Mpdf(['format' => 'A4']);
$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;
$mpdf->WriteHTML(getOutput($model));
$mpdf->output('1.pdf');

function getOutput($params) {
  $html = <<<EOT
<table>
  <tr>
    <td colspan=2 height="20" align="left" valign=bottom><font face="Times New Roman" color="#000000">{$params['user_name']}</font></td>
  </tr>
</table>
EOT;
  return $html;
}

src/Otl.php Outdated
@@ -1539,6 +1539,9 @@ function _applyGSUBrulesIndic($usetags, $scriptTag, $langsys, $is_old_spec)
continue;
}

if ($ptr + 1 == count($this->OTLdata)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use strict comparison here, no reason not to.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use strict comparison here, no reason not to.

I have modified that.

@finwe
Copy link
Member

finwe commented Nov 17, 2021

Thanks for the PR. Please add a test case reproducing your change. Can you also please explain the change a bit?

@SennoYuki
Copy link
Author

Thanks for the PR. Please add a test case reproducing your change. Can you also please explain the change a bit?

Do I need create a issue for the test?

@finwe
Copy link
Member

finwe commented Nov 17, 2021

Just amend the test case to this PR. See tests/Issues dir for reference

@SennoYuki
Copy link
Author

Just amend the test case to this PR. See tests/Issues dir for reference

I have added the unit test file. Do I need do anything eles?

@SennoYuki
Copy link
Author

Just amend the test case to this PR. See tests/Issues dir for reference

Look at this please. Thanks

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

Successfully merging this pull request may close these issues.

None yet

2 participants