Skip to content

Undefined offset: 1 in Binary stream #52

@mnabialek

Description

@mnabialek

I'm using DomPDF 0.7 for this and I use code something like this:

        <table>
            <tr class="title">
                <td colspan="2">
                    Some text
                </td>
            </tr>
            <tr class="links">
                <td>
                    <a href="http://xxx"><strong>xxx</strong></a>
                </td>
                <td>
                    <a href="mailto:yyy><strong>yyy</strong></a>
                </td>
            </tr>
        </table>

The problem here is that when I use <strong> inside 3rd <td> I'm getting undefined ofsset 1 in BinaryStream for this loop:

          for ($i = 0; $i < $type[1]; $i++) {
            $ret += $this->w($type[0], $data[$i]);
          }

As soon as I remove <strong> so I have code like this:

<a href="mailto:yyy>yyy</a>

no error appears. Exactly same situation is when I use CSS font-weight: bold instead of <strong> tag.

The solution that seems to be working is replacing the code I showed above into:

for ($i = 0; $i < $type[1]; $i++) {
     if (array_key_exists($i, $data)) {
           $ret += $this->w($type[0], $data[$i]);
     }
}

everything works as expected. If approved I can create pull request for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions