Open GoogleCodeExporter opened 9 years ago
Wow, that's pretty bizarre. Have you tried it on the svn version? A lot of work
has
gone on since 0.2.0.3.
Original comment by paul.biggar
on 16 Jan 2010 at 9:49
No I haven't tested it on the svn version yet. I've searched all issues for a
similar
problem though. Figured if it was fixed in svn, there would be a solved issue
in the
tracker...
But ofcourse using a loop construct isn't that special so I guess that if the
problem
would exists in the head, others would run into the same problem... I will try
to use
the svn version later and let you know if the issue is solved.
btw: I found that suppressing errors in a php file causes the same problem.
thus something like:
<?php
@foo();
?>
Original comment by sanderve...@gmail.com
on 18 Jan 2010 at 1:36
I see why this is happening. Try the attached patch and see if it fixes it.
The problem was the phc runs the parser at various points during compilation,
for some internal purposed. After running the parser, it runs all passes that
have already been run, which up until now included plugins. It should no longer
run plugins like that with the patch.
Original comment by paul.biggar
on 8 Sep 2010 at 9:47
Attachments:
I added the fix from the patch above in revision 3345. Please let me know if it
solves your problem.
Original comment by paul.biggar
on 8 Sep 2010 at 10:04
Thanks! I have tried to confirm this but I am not able to compile the latest
version. When running make it fails with:
./.libs/libphc.so: undefined reference to `PHP::get_superglobals()'
./.libs/libphc.so: undefined reference to `PHP::get_string_value(MIR::Literal*)'
If you know how to solve this I would be glad to test the fix. Otherwise you
can test it yourself with the most simple phc plugin, the hello world
application from the documentation for example.
helloworld.cpp:
#include <AST.h>
#include <pass_manager/Plugin_pass.h>
extern "C" void load (Pass_manager* pm, Plugin_pass* pass)
{
pm->add_after_named_pass (pass, new String ("ast"));
}
extern "C" void run_ast (AST::PHP_script* in, Pass_manager* pm, String* option)
{
cout << "Hello world (I'm a phc plugin!)" << endl;
}
sometest.php:
<?php
@foo();
?>
Then run:
~/myplugins$ phc_compile_plugin helloworld.cpp
~/myplugins$ phc --run helloworld.la sometest.php
If the bug still exists "cout << "Hello world (I'm a phc plugin!)" << endl;"
will be executed twice, if not it will only be executed once.
I wanted to test it myself with both versions, one before you path and one
after but since i am stuck i'm not getting anywhere. I have to note that am not
that experienced with compiling programs on linux so maybe I did something
wrong.
Original comment by sanderve...@gmail.com
on 15 Sep 2010 at 7:24
This error in trunk should now be fixed. Sorry for taking so long with this.
Let me know if you're still having issues.
Original comment by paul.biggar
on 26 Oct 2010 at 1:23
Original issue reported on code.google.com by
sanderve...@gmail.com
on 15 Jan 2010 at 12:58