473,509 Members | 10,100 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is it possible to stop the parser during file scan

Hello,

I am writing a tool to package several files into a single file. It is
quite similar to the 'phar' PEAR package but with more features, as I
want to connect it with an autoload mechanism. The problem I have today
and it is the same in the PHAR package, is that I don't know how to
restrict the PHP parser to the bootstrap code of the package file.

I explain : As in the shar format, the idea is to put some bootstrap
code first, and the rest of the data after it. The problem is that I
don't want PHP to consider any '<?php' string appearing in the data as
some PHP code during the initial phase. An example : if I have
something like :

<?php Bootrap code ?> ...Anything... <?php ... Anything...

In this case, I want the 2nd '<?php' to be considered as data and I
don't want the tokenizer to go and look inside this section before
executing the bootstrap code. I have the possibility to replace any
'<?' string by another one, say '</?' and then translate them when they
are extracted, but it is not easy to do because it changes every file
offsets ! And, of course, I reference the files through their offsets
in the package file.

And compressing the files is not the perfect solution because :

1. I want the compression to be optional for each file in the archive
(and also the compression method)
2. and the result of the compression process can contain a '<?' string,
which would automatically lead to a syntax error (with short tags
enabled).

I tried to put a chr(0) after my code but PHP doesn't care. If there is
a string or something allowing to stop the tokenizer at a given point
in a script, or if you have a smarter idea, please tell me.

Thanks in advance.

François

Mar 20 '06 #1
1 1712
For the ones who can have the same question, I got the answer from
Davey Shafik : It is done by the __halt_compiler() pseudo-function
(http://us2.php.net/halt_compiler)

Mar 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
412
by: ST | last post by:
Hi, I keep getting the parser error, and I have no idea why. I've tried a number of things including: 1)building/rebuilding about 100x 2)making sure all dll's are in the bin folder in the root...
0
307
by: jason | last post by:
Hello - sorry for all the posts, painful learning curve here. I have a simple CR 8.5 report that I brought into an asp.net site I am developing through vs.net 2005. When I run the report from...
6
3861
by: ST | last post by:
Hi, I keep getting the parser error, and I have no idea why. I've tried a number of things including: 1)building/rebuilding about 100x 2)making sure all dll's are in the bin folder in the root...
1
2817
by: Good Man | last post by:
Hi there I've noticed some very weird things happening with my current MySQL setup on my XP Laptop, a development machine. For a while, I have been trying to get the MySQL cache to work....
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5656
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5062
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4732
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3218
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.