cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug39542.phpt /tests/bug39542 bug39542.php
| From: | Dmitry Stogov | Date: | Fri, 11 May 2007 08:03:01 +0000 |
| Subject: | cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug39542.phpt /tests/bug39542 bug39542.php | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5793@lists.php.net to get a copy of this message | ||
dmitry Fri May 11 08:03:01 2007 UTC
Modified files:
/ZendEngine2 zend_vm_def.h zend_vm_execute.h
/ZendEngine2/tests bug39542.phpt
/ZendEngine2/tests/bug39542 bug39542.php
Log:
Fixed bug #39542 (Behaviour of require/include different to < 5.2.0)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.165&r2=1.166&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.165 ZendEngine2/zend_vm_def.h:1.166
--- ZendEngine2/zend_vm_def.h:1.165 Mon Apr 16 09:43:52 2007
+++ ZendEngine2/zend_vm_def.h Fri May 11 08:03:00 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.165 2007/04/16 09:43:52 dmitry Exp $ */
+/* $Id: zend_vm_def.h,v 1.166 2007/05/11 08:03:00 dmitry Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
@@ -2870,22 +2870,19 @@
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
zend_file_handle file_handle;
- char cwd[MAXPATHLEN];
- cwd_state state;
if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
- cwd[0] = '\0';
- } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
- cwd[0] = '\0';
- }
-
- state.cwd_length = strlen(cwd);
- state.cwd = zend_strndup(cwd, state.cwd_length);
+ cwd_state state;
+
+ state.cwd_length = 0;
+ state.cwd = malloc(1);
+ state.cwd[0] = 0;
- failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
- zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
+ failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
- free(state.cwd);
+ free(state.cwd);
+ }
if (failure_retval) {
/* do nothing */
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.168&r2=1.169&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.168 ZendEngine2/zend_vm_execute.h:1.169
--- ZendEngine2/zend_vm_execute.h:1.168 Mon Apr 16 09:43:52 2007
+++ ZendEngine2/zend_vm_execute.h Fri May 11 08:03:00 2007
@@ -1955,22 +1955,19 @@
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
zend_file_handle file_handle;
- char cwd[MAXPATHLEN];
- cwd_state state;
if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
- cwd[0] = '\0';
- } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
- cwd[0] = '\0';
- }
+ cwd_state state;
- state.cwd_length = strlen(cwd);
- state.cwd = zend_strndup(cwd, state.cwd_length);
+ state.cwd_length = 0;
+ state.cwd = malloc(1);
+ state.cwd[0] = 0;
- failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
- zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
+ failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
- free(state.cwd);
+ free(state.cwd);
+ }
if (failure_retval) {
/* do nothing */
@@ -4633,22 +4630,19 @@
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
zend_file_handle file_handle;
- char cwd[MAXPATHLEN];
- cwd_state state;
if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
- cwd[0] = '\0';
- } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
- cwd[0] = '\0';
- }
+ cwd_state state;
- state.cwd_length = strlen(cwd);
- state.cwd = zend_strndup(cwd, state.cwd_length);
+ state.cwd_length = 0;
+ state.cwd = malloc(1);
+ state.cwd[0] = 0;
- failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
- zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
+ failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
- free(state.cwd);
+ free(state.cwd);
+ }
if (failure_retval) {
/* do nothing */
@@ -7894,22 +7888,19 @@
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
zend_file_handle file_handle;
- char cwd[MAXPATHLEN];
- cwd_state state;
if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
- cwd[0] = '\0';
- } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
- cwd[0] = '\0';
- }
+ cwd_state state;
- state.cwd_length = strlen(cwd);
- state.cwd = zend_strndup(cwd, state.cwd_length);
+ state.cwd_length = 0;
+ state.cwd = malloc(1);
+ state.cwd[0] = 0;
- failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
- zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
+ failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
- free(state.cwd);
+ free(state.cwd);
+ }
if (failure_retval) {
/* do nothing */
@@ -20539,22 +20530,19 @@
case ZEND_INCLUDE_ONCE:
case ZEND_REQUIRE_ONCE: {
zend_file_handle file_handle;
- char cwd[MAXPATHLEN];
- cwd_state state;
if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
- cwd[0] = '\0';
- } else if (!VCWD_GETCWD(cwd, MAXPATHLEN)) {
- cwd[0] = '\0';
- }
+ cwd_state state;
- state.cwd_length = strlen(cwd);
- state.cwd = zend_strndup(cwd, state.cwd_length);
+ state.cwd_length = 0;
+ state.cwd = malloc(1);
+ state.cwd[0] = 0;
- failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
- zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
+ failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
+ zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
- free(state.cwd);
+ free(state.cwd);
+ }
if (failure_retval) {
/* do nothing */
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug39542.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug39542.phpt
diff -u /dev/null ZendEngine2/tests/bug39542.phpt:1.2
--- /dev/null Fri May 11 08:03:01 2007
+++ ZendEngine2/tests/bug39542.phpt Fri May 11 08:03:00 2007
@@ -0,0 +1,24 @@
+--TEST--
+Bug #39542 (Behaviour of require_once/include_once different to < 5.2.0)
+--FILE--
+<?php
+$oldcwd = getcwd();
+chdir(dirname(__FILE__));
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ set_include_path(dirname(__FILE__).'/bug39542;.');
+} else {
+ set_include_path(dirname(__FILE__).'/bug39542:.');
+}
+
+function __autoload($class) {
+ if (!require_once($class.'.php')) {
+ error_log('Error: Autoload class: '.$class.' not found!');
+ }
+}
+
+new bug39542();
+
+chdir($oldcwd);
+?>
+--EXPECT--
+ok
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug39542/bug39542.php?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug39542/bug39542.php
diff -u /dev/null ZendEngine2/tests/bug39542/bug39542.php:1.2
--- /dev/null Fri May 11 08:03:01 2007
+++ ZendEngine2/tests/bug39542/bug39542.php Fri May 11 08:03:00 2007
@@ -0,0 +1,7 @@
+<?php
+class bug39542 {
+ function bug39542() {
+ echo "ok\n";
+ }
+}
+?>