lime icon indicating copy to clipboard operation
lime copied to clipboard

PHP Fatal error: Cannot declare class error, because the name is already in use in

Open jcubic opened this issue 8 years ago • 6 comments

I got this error in line 161 when I try to call:

./lime.php examples/calc/calc.lime > parser.php

I'm using php version 7.0.8

jcubic avatar Aug 15 '16 15:08 jcubic

Yes, in PHP 7 this class (Error) is already defined. I'll modernize the code soon

rvanvelzen avatar Nov 21 '16 14:11 rvanvelzen

I got the same problem after "upgrading" to Linux Mint 18 :-(

AlgorithMan-de avatar Nov 24 '16 08:11 AlgorithMan-de

I think this patch might solve the issue - I have just moved everything in a namespace (php namespaces are a bit stupid though). I can't test it right now - I'm currently on a Linux Mint 17.3 machine that has php 5.5. It should be noted, that namespaces require php >= 5.3

To apply the patch, just run git apply limeNamespacePatch.txt inside the lime directory. limeNamespacePatch.txt

AlgorithMan-de avatar Nov 24 '16 09:11 AlgorithMan-de

I added namespaces with PSR-4 on my Lime fork and made it work with composer (and fixed some windows related issues). I'm not that experienced, but maybe you want to take a look at it anyway.

@AlgorithMan-de I think my first approach was similar to your patch and I had the problem, that the metaparser didn't work anymore. (I haven't tested your patch, so I don't know if it would have the same problem)

gene-sis avatar Nov 24 '16 19:11 gene-sis

I just tested it and it works :-)

AlgorithMan-de avatar Nov 24 '16 22:11 AlgorithMan-de

@rvanvelzen do you want to merge it? I can also fork it, merge it myself and request a pull if you prefer that.

AlgorithMan-de avatar Dec 06 '16 15:12 AlgorithMan-de