summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.frag4
-rw-r--r--acinclude.m44
-rw-r--r--configure.in32
-rwxr-xr-xext/spl/php_spl.c2
-rw-r--r--ext/standard/tests/strings/006.phpt2
-rw-r--r--ext/standard/tests/strings/007.phpt2
-rw-r--r--ext/standard/tests/strings/highlight_file.phpt17
-rw-r--r--ext/standard/tests/strings/strip_tags_basic1.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_basic2.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_error.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_variation1.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_variation10.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_variation2.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_variation3.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_variation4.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_variation6.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_variation7.phpt2
-rw-r--r--ext/standard/tests/strings/strip_tags_variation8.phpt2
-rw-r--r--ext/tokenizer/Makefile.frag4
-rw-r--r--ext/tokenizer/tests/token_get_all_variation14.phpt13
-rw-r--r--ext/tokenizer/tokenizer.c62
-rw-r--r--main/main.c48
-rw-r--r--sapi/cgi/cgi_main.c6
-rw-r--r--sapi/cli/php_cli.c5
-rw-r--r--win32/build/Makefile13
-rw-r--r--win32/build/config.w3236
26 files changed, 146 insertions, 126 deletions
diff --git a/Makefile.frag b/Makefile.frag
index 81d5428c77..c8b3cb2d80 100644
--- a/Makefile.frag
+++ b/Makefile.frag
@@ -7,7 +7,7 @@ $(builddir)/zend_language_scanner.lo: $(srcdir)/zend_language_parser.h
$(builddir)/zend_ini_scanner.lo: $(srcdir)/zend_ini_parser.h
$(srcdir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
- @$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
+ @(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l)
$(srcdir)/zend_language_parser.h: $(srcdir)/zend_language_parser.c
$(srcdir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
@@ -18,6 +18,6 @@ $(srcdir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
@$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
$(srcdir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
- @$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
+ @(cd $(top_srcdir); $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l)
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(srcdir)/zend_language_parser.h
diff --git a/acinclude.m4 b/acinclude.m4
index cc71dd08f2..59dbb24686 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2155,7 +2155,7 @@ AC_DEFUN([PHP_PROG_RE2C],[
if test -n "$RE2C"; then
AC_CACHE_CHECK([for re2c version], php_cv_re2c_version, [
re2c_vernum=`re2c --vernum 2>/dev/null`
- if test -z "$re2c_vernum" || test "$re2c_vernum" -lt "1200"; then
+ if test -z "$re2c_vernum" || test "$re2c_vernum" -lt "1304"; then
php_cv_re2c_version=invalid
else
php_cv_re2c_version="`re2c --version | cut -d ' ' -f 2 2>/dev/null` (ok)"
@@ -2164,7 +2164,7 @@ AC_DEFUN([PHP_PROG_RE2C],[
fi
case $php_cv_re2c_version in
""|invalid[)]
- AC_MSG_WARN([You will need re2c 0.12.0 or later if you want to regenerate PHP parsers.])
+ AC_MSG_WARN([You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.])
RE2C="exit 0;"
;;
esac
diff --git a/configure.in b/configure.in
index 57c37be79d..5aac926dd6 100644
--- a/configure.in
+++ b/configure.in
@@ -161,10 +161,38 @@ dnl check for -R, etc. switch
PHP_RUNPATH_SWITCH
dnl Checks for some support/generator progs
-PHP_PROG_RE2C
+
PHP_PROG_AWK
PHP_PROG_BISON
-PHP_PROG_LEX
+PHP_PROG_RE2C
+
+PHP_ARG_ENABLE(re2c-cgoto, whether to enable computed goto gcc extension with re2c,
+[ --enable-re2c-cgoto Enable -g flag to re2c to use computed goto gcc extension], no, no)
+
+if test "$PHP_RE2C_CGOTO" = "no"; then
+ RE2C_FLAGS=""
+else
+ AC_MSG_CHECKING([whether re2c -g works])
+ AC_TRY_COMPILE([],[
+ int main(int argc, const char **argv)
+ {
+ argc = argc;
+ argv = argv;
+label1:
+label2:
+ static void *adr[] = { &&label1, &&label2};
+ goto *adr[0];
+ return 0;
+ }
+ ],[
+ RE2C_FLAGS=""
+ AC_MSG_RESULT([no])
+ ],[
+ RE2C_FLAGS="-g"
+ AC_MSG_RESULT([yes])
+ ])
+fi
+PHP_SUBST(RE2C_FLAGS)
dnl Platform-specific compile settings.
dnl -------------------------------------------------------------------------
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 2804feb008..75bbe6284a 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -233,7 +233,7 @@ int spl_autoload(const zstr class_name, const zstr lc_name, int class_name_len,
zend_destroy_file_handle(&file_handle TSRMLS_CC);
} else {
new_op_array = NULL;
- zend_file_handle_dtor(&file_handle);
+ zend_file_handle_dtor(&file_handle TSRMLS_CC);
}
if (new_op_array) {
EG(return_value_ptr_ptr) = &result;
diff --git a/ext/standard/tests/strings/006.phpt b/ext/standard/tests/strings/006.phpt
index f0156ccf6e..3cee5d1405 100644
--- a/ext/standard/tests/strings/006.phpt
+++ b/ext/standard/tests/strings/006.phpt
@@ -1,5 +1,7 @@
--TEST--
highlight_file() and output buffer
+--INI--
+log_errors_max_len=4096
--FILE--
<?php
diff --git a/ext/standard/tests/strings/007.phpt b/ext/standard/tests/strings/007.phpt
index e0e5163892..12cfdbc1b3 100644
--- a/ext/standard/tests/strings/007.phpt
+++ b/ext/standard/tests/strings/007.phpt
@@ -1,5 +1,7 @@
--TEST--
php_strip_whitespace() and output buffer
+--INI--
+log_errors_max_len=4096
--FILE--
<?php
diff --git a/ext/standard/tests/strings/highlight_file.phpt b/ext/standard/tests/strings/highlight_file.phpt
index 24c0c53c5c..6ffa292971 100644
--- a/ext/standard/tests/strings/highlight_file.phpt
+++ b/ext/standard/tests/strings/highlight_file.phpt
@@ -6,6 +6,7 @@ highlight.comment=#FF9900
highlight.keyword=#007700
highlight.default=#0000BB
highlight.html=#000000
+allow_url_include=1
--FILE--
<?php
@@ -14,19 +15,9 @@ $filename = dirname(__FILE__)."/highlight_file.dat";
var_dump(highlight_file());
var_dump(highlight_file($filename));
-$data = <<<DATA
-<?php echo "test"; ?>
-DATA;
+var_dump(highlight_file('data:,<?php echo "test"; ?>'));
-file_put_contents($filename, $data);
-var_dump(highlight_file($filename));
-
-$data = <<<DATA
-<?php echo "test ?>
-DATA;
-
-file_put_contents($filename, $data);
-var_dump(highlight_file($filename));
+var_dump(highlight_file('data:,<?php echo "test ?>'));
$data = '
<?php
@@ -57,7 +48,7 @@ bool(false)
</span>
</code>bool(true)
<code><span style="color: #000000">
-<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"test&nbsp;?&gt;</span>
+<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #FF9900">"test&nbsp;?&gt;</span>
</span>
</code>bool(true)
<code><span style="color: #000000">
diff --git a/ext/standard/tests/strings/strip_tags_basic1.phpt b/ext/standard/tests/strings/strip_tags_basic1.phpt
index e08bf4bc1e..42f7a81af9 100644
--- a/ext/standard/tests/strings/strip_tags_basic1.phpt
+++ b/ext/standard/tests/strings/strip_tags_basic1.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : basic functionality - with default arguments
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_basic2.phpt b/ext/standard/tests/strings/strip_tags_basic2.phpt
index 2d3e012217..fb3e883957 100644
--- a/ext/standard/tests/strings/strip_tags_basic2.phpt
+++ b/ext/standard/tests/strings/strip_tags_basic2.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : basic functionality - with all arguments
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_error.phpt b/ext/standard/tests/strings/strip_tags_error.phpt
index 0fb2674d65..4fd8044031 100644
--- a/ext/standard/tests/strings/strip_tags_error.phpt
+++ b/ext/standard/tests/strings/strip_tags_error.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : error conditions
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_variation1.phpt b/ext/standard/tests/strings/strip_tags_variation1.phpt
index 76334a5737..e997051fc7 100644
--- a/ext/standard/tests/strings/strip_tags_variation1.phpt
+++ b/ext/standard/tests/strings/strip_tags_variation1.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - unexpected values for 'str' argument
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_variation10.phpt b/ext/standard/tests/strings/strip_tags_variation10.phpt
index aa6ff3c8c6..ae06ecd4d6 100644
--- a/ext/standard/tests/strings/strip_tags_variation10.phpt
+++ b/ext/standard/tests/strings/strip_tags_variation10.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - single quoted strings
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_variation2.phpt b/ext/standard/tests/strings/strip_tags_variation2.phpt
index 8205769224..40f8bac884 100644
--- a/ext/standard/tests/strings/strip_tags_variation2.phpt
+++ b/ext/standard/tests/strings/strip_tags_variation2.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - unexpected values for 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_variation3.phpt b/ext/standard/tests/strings/strip_tags_variation3.phpt
index 1e971b82bf..9e49276424 100644
--- a/ext/standard/tests/strings/strip_tags_variation3.phpt
+++ b/ext/standard/tests/strings/strip_tags_variation3.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - unexpected values for both 'str' and 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_variation4.phpt b/ext/standard/tests/strings/strip_tags_variation4.phpt
index 9ab3ccc539..d3fce45d39 100644
--- a/ext/standard/tests/strings/strip_tags_variation4.phpt
+++ b/ext/standard/tests/strings/strip_tags_variation4.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - invalid values for 'str' and valid 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_variation6.phpt b/ext/standard/tests/strings/strip_tags_variation6.phpt
index da50518c48..6db6408767 100644
--- a/ext/standard/tests/strings/strip_tags_variation6.phpt
+++ b/ext/standard/tests/strings/strip_tags_variation6.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - binary safe checking
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_variation7.phpt b/ext/standard/tests/strings/strip_tags_variation7.phpt
index e75e942d6b..a34536132d 100644
--- a/ext/standard/tests/strings/strip_tags_variation7.phpt
+++ b/ext/standard/tests/strings/strip_tags_variation7.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - invalid values for 'str' and 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/standard/tests/strings/strip_tags_variation8.phpt b/ext/standard/tests/strings/strip_tags_variation8.phpt
index 86591ac0e9..29c0ed0020 100644
--- a/ext/standard/tests/strings/strip_tags_variation8.phpt
+++ b/ext/standard/tests/strings/strip_tags_variation8.phpt
@@ -1,7 +1,7 @@
--TEST--
Test strip_tags() function : usage variations - valid value for 'str' and invalid values for 'allowable_tags'
--INI--
-set short_open_tag = on
+short_open_tag = on
--FILE--
<?php
/* Prototype : string strip_tags(string $str [, string $allowable_tags])
diff --git a/ext/tokenizer/Makefile.frag b/ext/tokenizer/Makefile.frag
index 6802d40e92..6df0d19947 100644
--- a/ext/tokenizer/Makefile.frag
+++ b/ext/tokenizer/Makefile.frag
@@ -1,2 +1,2 @@
-$(top_srcdir)/Zend/zend_language_parser.h:
-$(builddir)/tokenizer.lo: $(top_srcdir)/Zend/zend_language_parser.h
+
+$(builddir)/tokenizer.lo: $(top_srcdir)/Zend/zend_language_parser.c $(top_srcdir)/Zend/zend_language_scanner.c \ No newline at end of file
diff --git a/ext/tokenizer/tests/token_get_all_variation14.phpt b/ext/tokenizer/tests/token_get_all_variation14.phpt
index 61a2f8f9ee..40a3c2c5de 100644
--- a/ext/tokenizer/tests/token_get_all_variation14.phpt
+++ b/ext/tokenizer/tests/token_get_all_variation14.phpt
@@ -516,22 +516,13 @@ echo "hello world"; ?>"
}
}
-- with invalid PHP tags and tokens --
-array(2) {
+array(1) {
[0]=>
array(3) {
[0]=>
int(313)
[1]=>
- string(18) "<PDP display $a; "
- [2]=>
- int(1)
- }
- [1]=>
- array(3) {
- [0]=>
- int(313)
- [1]=>
- string(1) "<"
+ string(19) "<PDP display $a; <"
[2]=>
int(1)
}
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index 082619b275..963ffd5b39 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -27,67 +27,9 @@
#include "ext/standard/info.h"
#include "php_tokenizer.h"
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-typedef unsigned int yy_size_t;
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
#include "zend.h"
#include "zend_language_scanner.h"
+#include "zend_language_scanner_defs.h"
#include <zend_language_parser.h>
#define zendtext LANG_SCNG(yy_text)
@@ -224,7 +166,7 @@ PHP_FUNCTION(token_get_all)
RETURN_EMPTY_STRING();
}
- LANG_SCNG(start) = 1;
+ LANG_SCNG(yy_state) = yycINITIAL;
tokenize(return_value TSRMLS_CC);
diff --git a/main/main.c b/main/main.c
index e375464d40..fecbfd3d5c 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1159,15 +1159,26 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path
}
/* }}} */
-static void stream_closer_for_zend(void *handle TSRMLS_DC) /* {{{ */
+static void php_zend_stream_closer(void *handle TSRMLS_DC) /* {{{ */
{
php_stream_close((php_stream*)handle);
}
/* }}} */
-static long stream_fteller_for_zend(void *handle TSRMLS_DC) /* {{{ */
+static void php_zend_stream_mmap_closer(void *handle TSRMLS_DC) /* {{{ */
{
- return (long)php_stream_tell((php_stream*)handle);
+ php_stream_mmap_unmap((php_stream*)handle);
+ php_zend_stream_closer(handle TSRMLS_CC);
+}
+/* }}} */
+
+static size_t php_zend_stream_fsizer(void *handle TSRMLS_DC) /* {{{ */
+{
+ php_stream_statbuf ssb;
+ if (php_stream_stat((php_stream*)handle, &ssb) == 0) {
+ return ssb.sb.st_size;
+ }
+ return 0;
}
/* }}} */
@@ -1179,19 +1190,30 @@ static int php_stream_open_for_zend(const char *filename, zend_file_handle *hand
PHPAPI int php_stream_open_for_zend_ex(const char *filename, zend_file_handle *handle, int mode TSRMLS_DC) /* {{{ */
{
- php_stream *stream;
-
- stream = php_stream_open_wrapper((char *)filename, "rb", mode, &handle->opened_path);
+ char *p;
+ size_t len, mapped_len;
+ php_stream *stream = php_stream_open_wrapper((char *)filename, "rb", mode, &handle->opened_path);
if (stream) {
- handle->type = ZEND_HANDLE_STREAM;
handle->filename = (char*)filename;
handle->free_filename = 0;
- handle->handle.stream.handle = stream;
- handle->handle.stream.reader = (zend_stream_reader_t)_php_stream_read;
- handle->handle.stream.closer = stream_closer_for_zend;
- handle->handle.stream.fteller = stream_fteller_for_zend;
- handle->handle.stream.interactive = 0;
+ handle->handle.stream.handle = stream;
+ handle->handle.stream.reader = (zend_stream_reader_t)_php_stream_read;
+ handle->handle.stream.fsizer = php_zend_stream_fsizer;
+ handle->handle.stream.isatty = 0;
+ /* can we mmap immeadiately? */
+ memset(&handle->handle.stream.mmap, 0, sizeof(handle->handle.stream.mmap));
+ len = php_zend_stream_fsizer(stream TSRMLS_CC) + ZEND_MMAP_AHEAD;
+ if (php_stream_mmap_possible(stream)
+ && (p = php_stream_mmap_range(stream, 0, len, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped_len)) != NULL) {
+ handle->handle.stream.closer = php_zend_stream_mmap_closer;
+ handle->handle.stream.mmap.buf = p;
+ handle->handle.stream.mmap.len = mapped_len;
+ handle->type = ZEND_HANDLE_MAPPED;
+ } else {
+ handle->handle.stream.closer = php_zend_stream_closer;
+ handle->type = ZEND_HANDLE_STREAM;
+ }
/* suppress warning if this stream is not explicitly closed */
php_stream_auto_cleanup(stream);
@@ -2126,7 +2148,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
EG(exit_status) = 0;
if (php_handle_special_queries(TSRMLS_C)) {
- zend_file_handle_dtor(primary_file);
+ zend_file_handle_dtor(primary_file TSRMLS_CC);
return 0;
}
#ifndef HAVE_BROKEN_GETCWD
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index ad061490fd..e59b1cc811 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -1966,7 +1966,7 @@ consult the installation file that came with this distribution, or visit \n\
case PHP_MODE_STRIP:
if (open_file_for_scanning(&file_handle TSRMLS_CC) == SUCCESS) {
zend_strip(TSRMLS_C);
- fclose(file_handle.handle.fp);
+ zend_file_handle_dtor(&file_handle TSRMLS_CC);
php_output_teardown();
}
return SUCCESS;
@@ -1981,7 +1981,7 @@ consult the installation file that came with this distribution, or visit \n\
if (fastcgi) {
goto fastcgi_request_done;
}
- fclose(file_handle.handle.fp);
+ zend_file_handle_dtor(&file_handle TSRMLS_CC);
php_output_teardown();
}
return SUCCESS;
@@ -1992,7 +1992,7 @@ consult the installation file that came with this distribution, or visit \n\
case PHP_MODE_INDENT:
open_file_for_scanning(&file_handle TSRMLS_CC);
zend_indent();
- fclose(file_handle.handle.fp);
+ zend_file_handle_dtor(&file_handle TSRMLS_CC);
php_output_teardown();
return SUCCESS;
break;
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 6b0f419cf2..7bca968aef 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -566,6 +566,9 @@ static int cli_seek_file_begin(zend_file_handle *file_handle, char *script_file,
*lineno = 1;
+ file_handle->type = ZEND_HANDLE_FP;
+ file_handle->opened_path = NULL;
+ file_handle->free_filename = 0;
if (!(file_handle->handle.fp = VCWD_FOPEN(script_file, "rb"))) {
php_printf("Could not open input file: %s\n", script_file);
return FAILURE;
@@ -1182,7 +1185,7 @@ int main(int argc, char *argv[])
case PHP_MODE_INDENT:
open_file_for_scanning(&file_handle TSRMLS_CC);
zend_indent();
- fclose(file_handle.handle.fp);
+ zend_file_handle_dtor(file_handle.handle TSRMLS_CC);
goto out;
break;
#endif
diff --git a/win32/build/Makefile b/win32/build/Makefile
index 9bb242aa1f..a929f58d73 100644
--- a/win32/build/Makefile
+++ b/win32/build/Makefile
@@ -21,6 +21,7 @@ CC="$(CL)"
LD="$(LINK)"
MC="$(MC)"
MT="$(MT)"
+RE2C="$(RE2C)"
MCFILE=$(BUILD_DIR)\wsyslog.rc
@@ -28,10 +29,16 @@ all: generated_files $(EXT_TARGETS) $(PECL_TARGETS) $(SAPI_TARGETS)
build_dirs: $(BUILD_DIR) $(BUILD_DIRS_SUB)
+!if $(RE2C) == ""
+generated_files: build_dirs Zend\zend_ini_parser.c \
+ Zend\zend_language_parser.c \
+ $(PHPDEF) $(MCFILE)
+!else
generated_files: build_dirs Zend\zend_ini_parser.c \
Zend\zend_language_parser.c Zend\zend_ini_scanner.c \
Zend\zend_language_scanner.c \
$(PHPDEF) $(MCFILE)
+!endif
$(BUILD_DIR)\$(PHPDLL).def: $(PHP_DLL_DEF_SOURCES)
type $(PHP_DLL_DEF_SOURCES) > $(BUILD_DIR)\$(PHPDLL).def
@@ -42,11 +49,13 @@ Zend\zend_ini_parser.c Zend\zend_ini_parser.h: Zend\zend_ini_parser.y
Zend\zend_language_parser.c Zend\zend_language_parser.h: Zend\zend_language_parser.y
$(BISON) --output=Zend/zend_language_parser.c -v -d -p zend Zend/zend_language_parser.y
+!if $(RE2C) != ""
Zend\zend_ini_scanner.c: Zend\flex.skl Zend\zend_ini_scanner.l
- $(FLEX) -B -i -SZend/flex.skl -Pini_ -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l
+ $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_ini_scanner_defs.h -oZend/zend_ini_scanner.c Zend/zend_ini_scanner.l
Zend\zend_language_scanner.c: Zend\flex.skl Zend\zend_language_scanner.l
- $(FLEX) -i -SZend/flex.skl -Pzend -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
+ $(RE2C) $(RE2C_FLAGS) --case-inverted -cbdFt Zend/zend_language_scanner_defs.h -oZend/zend_language_scanner.c Zend/zend_language_scanner.l
+!endif
PHPDLL_RES=$(BUILD_DIR)\$(PHPDLL).res
diff --git a/win32/build/config.w32 b/win32/build/config.w32
index 8cb44452d8..c6be09a4c5 100644
--- a/win32/build/config.w32
+++ b/win32/build/config.w32
@@ -56,10 +56,40 @@ PATH_PROG('lib', null, 'MAKE_LIB');
if (!PATH_PROG('bison')) {
ERROR('bison is required')
}
-if (!PATH_PROG('flex')) {
- ERROR('flex is required')
+
+// There's a minimum requirement for re2c..
+MINRE2C = "0.13.4";
+
+function probe_re2c_version(RE2C)
+{
+ var command = "cmd /c " + RE2C + " -v";
+ var version = execute(command + '" 2>&1"');
+
+ if (version.match(/((\d+)\.(\d+)\.(\d+))/)) {
+ return RegExp.$1;
+ }
+ return 0;
+}
+
+RE2C = PATH_PROG('re2c');
+if (RE2C) {
+ var intvers, intmin;
+ var pattern = /\./g;
+
+ RE2CVERS = probe_re2c_version(RE2C);
+ intvers = RE2CVERS.replace(pattern, '') - 0;
+ intmin = MINRE2C.replace(pattern, '') - 0;
+
+ if (intvers < intmin) {
+ STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C + ', ' + RE2CVERS + ' detected');
+ STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
+ DEFINE('RE2C', '');
+ } else {
+ DEFINE('RE2C_FLAGS', '');
+ }
+} else {
+ STDOUT.WriteLine('Parsers will not be regenerated');
}
-PATH_PROG('re2c');
PATH_PROG('zip');
PATH_PROG('lemon');