ircmaxell / php-compiler

A compiler. For PHP
MIT License
794 stars 33 forks source link

Remove reference to ->value after toString() #19

Closed driusan closed 5 years ago

driusan commented 5 years ago

This fixes a fatal type error in OpCode::TYPE_CONST_FETCH where it was attempting to fetch the value property after calling toString(). Since string is not an object, it would always return null.

With this, you can run the "php bin/vm.php foo.php" with the following foo.php and not crash:

<?php
$a = true;

(I'm not sure if this causes any regressions with constants since I can't get the test suite to run with or without this change, but I can't see how the ->value access after toString would ever work.)