facebook / hhvm

A virtual machine for executing programs written in Hack.
https://hhvm.com
Other
18.21k stars 3k forks source link

XHP Issues with SVG on 3.23.1 #8073

Closed justinwray closed 3 years ago

justinwray commented 6 years ago

HHVM Version: 3.23.1

When returning XHP of an SVG tag a fatal error is thrown:

Fatal error: static analysis error: supposedly unreachable code was reached in /var/www/example/example.php on line 22

Example Code:

  public async function example(): Awaitable<:xhp> {
    return
      <svg
        id="example-map"
        xmlns="http://www.w3.org/2000/svg"
        amcharts="http://amcharts.com/ammap"
        xlink="http://www.w3.org/1999/xlink"
        viewBox="0 0 1008 651"
        preserveAspectRatio="xMidYMid meet">
        <defs>
          <amcharts:ammap
            projection="mercator"
            leftLongitude="-169.6"
            topLatitude="83.68"
            rightLongitude="190.25"
            bottomLatitude="-55.55">
          </amcharts:ammap>
        </defs>
        <g class="view-controller">
          <g class="country-hover"></g>
        </g>
      </svg>;

Expected Result: Return XHP of SVG

Actual Result: Fatal Unreachable Error.

justinwray commented 6 years ago

Tagging: @fredemmott @stevcoll @gsingh93

fredemmott commented 6 years ago

Are you using repo authoritative mode? Did this work on past releases?

stevcoll commented 6 years ago

@fredemmott No this was tested with repo authoritative mode off. This code worked fine on all previous releases. We are currently running it on HHVM 3.21 with no errors.

fredemmott commented 6 years ago

Huh. That error looks like it's only generated by hhbbc, which isn't supposed to be executed unless you're in repo-auth-mode

lexidor commented 3 years ago

I am going over old issues on this repository, to see which ones apply to the current versions of hhvm.

I reran your repro. I declared the xhp classes for the elements. The code worked fine in both repo auth and live mode. Xhp has undergone some major changes since this issue was created, so the underlying issue may have moved.