[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/Zend/zend_compile.c trunk/Zend/zend_compile.c

2009-09-05 Thread Pierre-Alain Joye
pajoye   Sat, 05 Sep 2009 21:16:05 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288096

Log:
- don't hide previous declaration

Changed paths:
U   php/php-src/branches/PHP_5_3/Zend/zend_compile.c
U   php/php-src/trunk/Zend/zend_compile.c

Modified: php/php-src/branches/PHP_5_3/Zend/zend_compile.c
===
--- php/php-src/branches/PHP_5_3/Zend/zend_compile.c2009-09-05 20:59:27 UTC 
(rev 288095)
+++ php/php-src/branches/PHP_5_3/Zend/zend_compile.c2009-09-05 21:16:05 UTC 
(rev 288096)
@@ -5191,31 +5191,31 @@

if (CG(current_namespace)) {
/* Prefix import name with current namespace name to avoid 
conflicts with classes */
-   char *ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 + 
Z_STRLEN_P(name) + 1);
+   char *c_ns_name = emalloc(Z_STRLEN_P(CG(current_namespace)) + 1 
+ Z_STRLEN_P(name) + 1);

-   zend_str_tolower_copy(ns_name, 
Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace)));
-   ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\';
-   memcpy(ns_name+Z_STRLEN_P(CG(current_namespace))+1, lcname, 
Z_STRLEN_P(name)+1);
-   if (zend_hash_exists(CG(class_table), ns_name, 
Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) {
+   zend_str_tolower_copy(c_ns_name, 
Z_STRVAL_P(CG(current_namespace)), Z_STRLEN_P(CG(current_namespace)));
+   c_ns_name[Z_STRLEN_P(CG(current_namespace))] = '\\';
+   memcpy(c_ns_name+Z_STRLEN_P(CG(current_namespace))+1, lcname, 
Z_STRLEN_P(name)+1);
+   if (zend_hash_exists(CG(class_table), c_ns_name, 
Z_STRLEN_P(CG(current_namespace)) + 1 + Z_STRLEN_P(name)+1)) {
char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), 
Z_STRLEN_P(ns));

if (Z_STRLEN_P(ns) != Z_STRLEN_P(CG(current_namespace)) 
+ 1 + Z_STRLEN_P(name) ||
-   memcmp(tmp, ns_name, Z_STRLEN_P(ns))) {
+   memcmp(tmp, c_ns_name, Z_STRLEN_P(ns))) {
zend_error(E_COMPILE_ERROR, "Cannot use %s as 
%s because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name));
}
efree(tmp);
}
-   efree(ns_name);
+   efree(c_ns_name);
} else if (zend_hash_find(CG(class_table), lcname, Z_STRLEN_P(name)+1, 
(void**)&pce) == SUCCESS &&
   (*pce)->type == ZEND_USER_CLASS &&
   (*pce)->filename == CG(compiled_filename)) {
-   char *tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), 
Z_STRLEN_P(ns));
+   char *c_tmp = zend_str_tolower_dup(Z_STRVAL_P(ns), 
Z_STRLEN_P(ns));

if (Z_STRLEN_P(ns) != Z_STRLEN_P(name) ||
-   memcmp(tmp, lcname, Z_STRLEN_P(ns))) {
+   memcmp(c_tmp, lcname, Z_STRLEN_P(ns))) {
zend_error(E_COMPILE_ERROR, "Cannot use %s as %s 
because the name is already in use", Z_STRVAL_P(ns), Z_STRVAL_P(name));
}
-   efree(tmp);
+   efree(c_tmp);
}

if (zend_hash_add(CG(current_import), lcname, Z_STRLEN_P(name)+1, &ns, 
sizeof(zval*), NULL) != SUCCESS) {

Modified: php/php-src/trunk/Zend/zend_compile.c
===
--- php/php-src/trunk/Zend/zend_compile.c   2009-09-05 20:59:27 UTC (rev 
288095)
+++ php/php-src/trunk/Zend/zend_compile.c   2009-09-05 21:16:05 UTC (rev 
288096)
@@ -5480,28 +5480,28 @@
if (CG(current_namespace)) {
/* Prefix import name with current namespace name to avoid 
conflicts with classes */
uint ns_name_len;
-   zstr ns_name = 
zend_u_str_case_fold(Z_TYPE_P(CG(current_namespace)), 
Z_UNIVAL_P(CG(current_namespace)), Z_UNILEN_P(CG(current_namespace)), 0, 
&ns_name_len);
+   zstr c_ns_name = 
zend_u_str_case_fold(Z_TYPE_P(CG(current_namespace)), 
Z_UNIVAL_P(CG(current_namespace)), Z_UNILEN_P(CG(current_namespace)), 0, 
&ns_name_len);

if (Z_TYPE_P(CG(current_namespace)) == IS_UNICODE) {
-   ns_name.u = eurealloc(ns_name.u, ns_name_len + 1 + 
lcname_len + 1);
-   ns_name.u[ns_name_len] = '\\';
-   memcpy(ns_name.u + ns_name_len + 1, lcname.u, 
UBYTES(lcname_len + 1));
+   c_ns_name.u = eurealloc(c_ns_name.u, ns_name_len + 1 + 
lcname_len + 1);
+   c_ns_name.u[ns_name_len] = '\\';
+   memcpy(c_ns_name.u + ns_name_len + 1, lcname.u, 
UBYTES(lcname_len + 1));
} else {
-   ns_name.s = erealloc(ns_name.s, ns_name_len + 1 + 
lcname_len + 1);
-   ns_name.s[ns_name_len] = '\\';
-   mem

[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/Zend/ zend_API.c

2009-09-05 Thread Pierre-Alain Joye
pajoye   Sat, 05 Sep 2009 19:01:06 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288089

Log:
- WS

Changed paths:
U   php/php-src/branches/PHP_5_2/Zend/zend_API.c

Modified: php/php-src/branches/PHP_5_2/Zend/zend_API.c
===
--- php/php-src/branches/PHP_5_2/Zend/zend_API.c2009-09-05 19:00:05 UTC 
(rev 288088)
+++ php/php-src/branches/PHP_5_2/Zend/zend_API.c2009-09-05 19:01:06 UTC 
(rev 288089)
@@ -901,10 +901,10 @@


zend_hash_get_current_key_ex(&class_type->default_static_members, &str_index, 
&str_length, &num_index, 0, &pos);
if ((*p)->is_ref &&
-   class_type->parent &&
-   
zend_hash_find(&class_type->parent->default_static_members, str_index, 
str_length, (void**)&q) == SUCCESS &&
-   *p == *q &&
-   
zend_hash_find(CE_STATIC_MEMBERS(class_type->parent), str_index, str_length, 
(void**)&q) == SUCCESS) {
+   class_type->parent &&
+   
zend_hash_find(&class_type->parent->default_static_members, str_index, 
str_length, (void**)&q) == SUCCESS &&
+   *p == *q &&
+   
zend_hash_find(CE_STATIC_MEMBERS(class_type->parent), str_index, str_length, 
(void**)&q) == SUCCESS) {
(*q)->refcount++;
(*q)->is_ref = 1;

zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)q, 
sizeof(zval*), NULL);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/Zend/zend_API.c branches/PHP_5_3/Zend/zend_API.c trunk/Zend/zend_API.c

2009-09-05 Thread Pierre-Alain Joye
pajoye   Sat, 05 Sep 2009 19:00:05 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288088

Log:
- don't hide early declaration

Changed paths:
U   php/php-src/branches/PHP_5_2/Zend/zend_API.c
U   php/php-src/branches/PHP_5_3/Zend/zend_API.c
U   php/php-src/trunk/Zend/zend_API.c

Modified: php/php-src/branches/PHP_5_2/Zend/zend_API.c
===
--- php/php-src/branches/PHP_5_2/Zend/zend_API.c2009-09-05 18:22:16 UTC 
(rev 288087)
+++ php/php-src/branches/PHP_5_2/Zend/zend_API.c2009-09-05 19:00:05 UTC 
(rev 288088)
@@ -909,13 +909,13 @@
(*q)->is_ref = 1;

zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)q, 
sizeof(zval*), NULL);
} else {
-   zval *q;
+   zval *r;

-   ALLOC_ZVAL(q);
-   *q = **p;
-   INIT_PZVAL(q);
-   zval_copy_ctor(q);
-   
zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)&q, 
sizeof(zval*), NULL);
+   ALLOC_ZVAL(r);
+   *r = **p;
+   INIT_PZVAL(r);
+   zval_copy_ctor(r);
+   
zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)&r, 
sizeof(zval*), NULL);
}

zend_hash_move_forward_ex(&class_type->default_static_members, &pos);
}

Modified: php/php-src/branches/PHP_5_3/Zend/zend_API.c
===
--- php/php-src/branches/PHP_5_3/Zend/zend_API.c2009-09-05 18:22:16 UTC 
(rev 288087)
+++ php/php-src/branches/PHP_5_3/Zend/zend_API.c2009-09-05 19:00:05 UTC 
(rev 288088)
@@ -1038,13 +1038,13 @@
Z_SET_ISREF_PP(q);

zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)q, 
sizeof(zval*), NULL);
} else {
-   zval *q;
+   zval *r;

-   ALLOC_ZVAL(q);
-   *q = **p;
-   INIT_PZVAL(q);
-   zval_copy_ctor(q);
-   
zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)&q, 
sizeof(zval*), NULL);
+   ALLOC_ZVAL(r);
+   *r = **p;
+   INIT_PZVAL(r);
+   zval_copy_ctor(r);
+   
zend_hash_add(CE_STATIC_MEMBERS(class_type), str_index, str_length, (void**)&r, 
sizeof(zval*), NULL);
}

zend_hash_move_forward_ex(&class_type->default_static_members, &pos);
}

Modified: php/php-src/trunk/Zend/zend_API.c
===
--- php/php-src/trunk/Zend/zend_API.c   2009-09-05 18:22:16 UTC (rev 288087)
+++ php/php-src/trunk/Zend/zend_API.c   2009-09-05 19:00:05 UTC (rev 288088)
@@ -1320,13 +1320,13 @@
Z_SET_ISREF_PP(q);

zend_u_hash_add(CE_STATIC_MEMBERS(class_type), utype, str_index, str_length, 
(void**)q, sizeof(zval*), NULL);
} else {
-   zval *q;
+   zval *r;

-   ALLOC_ZVAL(q);
-   *q = **p;
-   INIT_PZVAL(q);
-   zval_copy_ctor(q);
-   
zend_u_hash_add(CE_STATIC_MEMBERS(class_type), utype, str_index, str_length, 
(void**)&q, sizeof(zval*), NULL);
+   ALLOC_ZVAL(r);
+   *r = **p;
+   INIT_PZVAL(r);
+   zval_copy_ctor(r);
+   
zend_u_hash_add(CE_STATIC_MEMBERS(class_type), utype, str_index, str_length, 
(void**)&r, sizeof(zval*), NULL);
}

zend_hash_move_forward_ex(&class_type->default_static_members, &pos);

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/sapi/cgi/ cgi_main.c

2009-09-05 Thread Felipe Pena
felipe   Sat, 05 Sep 2009 18:22:16 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288087

Log:
- Drop unused var

Changed paths:
U   php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c

Modified: php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c
===
--- php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c2009-09-05 18:21:10 UTC 
(rev 288086)
+++ php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c2009-09-05 18:22:16 UTC 
(rev 288087)
@@ -1454,7 +1454,6 @@
int exit_status = SUCCESS;
int cgi = 0, c, i, len;
zend_file_handle file_handle;
-   int retval = FAILURE;
char *s;

/* temporary locals */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/trunk/sapi/cgi/ cgi_main.c

2009-09-05 Thread Felipe Pena
felipe   Sat, 05 Sep 2009 18:21:10 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288086

Log:
- Drop unused var

Changed paths:
U   php/php-src/trunk/sapi/cgi/cgi_main.c

Modified: php/php-src/trunk/sapi/cgi/cgi_main.c
===
--- php/php-src/trunk/sapi/cgi/cgi_main.c   2009-09-05 18:10:31 UTC (rev 
288085)
+++ php/php-src/trunk/sapi/cgi/cgi_main.c   2009-09-05 18:21:10 UTC (rev 
288086)
@@ -1451,7 +1451,6 @@
int exit_status = SUCCESS;
int cgi = 0, c, i, len;
zend_file_handle file_handle;
-   int retval = FAILURE;
char *s;

/* temporary locals */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746.phpt branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_1.phpt branches/PHP_5_3/ext/standard/t

2009-09-05 Thread Pierre-Alain Joye
pajoye   Sat, 05 Sep 2009 18:10:31 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288085

Log:
- add test for #48746

Bug: http://bugs.php.net/48746 (Feedback) Unable to browse directories within 
Junction Points
  
Changed paths:
A   php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/
A   
php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746.phpt
A   
php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_1.phpt
A   
php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_2.phpt
A   
php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_3.phpt
A   php/php-src/trunk/ext/standard/tests/file/windows_links/
A   php/php-src/trunk/ext/standard/tests/file/windows_links/bug48746.phpt
A   php/php-src/trunk/ext/standard/tests/file/windows_links/bug48746_1.phpt
A   php/php-src/trunk/ext/standard/tests/file/windows_links/bug48746_2.phpt
A   php/php-src/trunk/ext/standard/tests/file/windows_links/bug48746_3.phpt

Added: php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746.phpt
===
--- php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746.phpt	2009-09-05 18:10:31 UTC (rev 288085)
@@ -0,0 +1,54 @@
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDIT--
+Venkat Raman Don (don.ra...@microsoft.com)
+
+--SKIPIF--
+
+--FILE--
+
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
\ No newline at end of file

Added: php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_1.phpt
===
--- php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_1.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_1.phpt	2009-09-05 18:10:31 UTC (rev 288085)
@@ -0,0 +1,56 @@
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDIT--
+Venkat Raman Don (don.ra...@microsoft.com)
+
+--SKIPIF--
+
+--FILE--
+");
+include_once "mklink_junction\\a.php";
+file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "");
+require "$fullpath\\mnt\\test\\directory\\b.php";
+file_put_contents("$fullpath\\mnt\\test\\mklink_junction\\c.php", "");
+require_once "$fullpath\\mnt\\test\\mklink_junction\\c.php";
+var_dump(is_file("mklink_junction\\a.php"));
+var_dump(is_file("$fullpath\\mnt\\test\\directory\\b.php"));
+var_dump(is_file("$fullpath\\mnt\\test\\mklink_junction\\c.php"));
+unlink("$fullpath\\mnt\\test\\directory\\b.php");
+unlink("$fullpath\\mnt\\test\\mklink_junction\\c.php");
+unlink("mklink_junction\\a.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+I am included.
+I am included.
+I am included.
+bool(true)
+bool(true)
+bool(true)
\ No newline at end of file

Added: php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_2.phpt
===
--- php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_2.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_2.phpt	2009-09-05 18:10:31 UTC (rev 288085)
@@ -0,0 +1,66 @@
+--TEST--
+Bug#48746 - Junction not working properly
+
+--CREDIT--
+Venkat Raman Don (don.ra...@microsoft.com)
+
+--SKIPIF--
+
+--FILE--
+");
+file_put_contents("$fullpath\\mnt\\test\\directory\\b.php", "");
+print_r(scandir("mklink_junction"));
+print_r(scandir("$fullpath\\mnt\\test\\directory"));
+print_r(scandir("$fullpath\\mnt\\test\\mklink_junction"));
+unlink("$fullpath\\mnt\\test\\directory\\b.php");
+unlink("mklink_junction\\a.php");
+chdir($old_dir);
+rmdir(__DIR__ . "\\mnt\\test\\directory");
+rmdir(__DIR__ . "\\mnt\\test\\mklink_junction");
+rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
+rmdir(__DIR__ . "\\mnt\\test");
+rmdir(__DIR__ . "\\mnt");
+
+?>
+--EXPECT--
+Array
+(
+[0] => .
+[1] => ..
+[2] => a.php
+[3] => b.php
+)
+Array
+(
+[0] => .
+[1] => ..
+[2] => a.php
+[3] => b.php
+)
+Array
+(
+[0] => .
+[1] => ..
+[2] => a.php
+[3] => b.php
+)
\ No newline at end of file

Added: php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_3.phpt
===
--- php/php-src/branches/PHP_5_3/ext/standard/tests/file/windows_links/bug48746_3.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_3/e

[PHP-CVS] svn: /php/php-src/trunk/ext/filter/ filter.c logical_filters.c

2009-09-05 Thread Pierre-Alain Joye
pajoye   Sat, 05 Sep 2009 17:39:18 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288084

Log:
- useless #ifdef

Changed paths:
U   php/php-src/trunk/ext/filter/filter.c
U   php/php-src/trunk/ext/filter/logical_filters.c

Modified: php/php-src/trunk/ext/filter/filter.c
===
--- php/php-src/trunk/ext/filter/filter.c   2009-09-05 17:35:26 UTC (rev 
288083)
+++ php/php-src/trunk/ext/filter/filter.c   2009-09-05 17:39:18 UTC (rev 
288084)
@@ -485,11 +485,6 @@
INIT_PZVAL(tmp_new_var);
php_zval_filter(&tmp_new_var, IF_G(default_filter), 
IF_G(default_filter_flags), NULL, NULL/*charset*/, 0 TSRMLS_CC);
}
-#if PHP_VERSION_ID<6
-   else if (PG(magic_quotes_gpc)) {
-   Z_STRVAL(new_var) = php_addslashes(*val, 
Z_STRLEN(new_var), &Z_STRLEN(new_var), 0 TSRMLS_CC);
-   }
-#endif
else {
Z_STRVAL(new_var) = estrndup(*val, val_len);
}
@@ -554,11 +549,7 @@

 {
zval *array_ptr = NULL;
-   zend_bool jit_initialization = (PG(auto_globals_jit)
-#if PHP_VERSION_ID<6
-&& !PG(register_globals) && !PG(register_long_arrays)
-#endif
-);
+   zend_bool jit_initialization = (PG(auto_globals_jit));

switch (arg) {
case PARSE_GET:

Modified: php/php-src/trunk/ext/filter/logical_filters.c
===
--- php/php-src/trunk/ext/filter/logical_filters.c  2009-09-05 17:35:26 UTC 
(rev 288083)
+++ php/php-src/trunk/ext/filter/logical_filters.c  2009-09-05 17:39:18 UTC 
(rev 288084)
@@ -24,10 +24,6 @@
 #include "ext/standard/url.h"
 #include "ext/pcre/php_pcre.h"

-#if PHP_MAJOR_VERSION <= 6
-#define zend_ascii_hash_find(hash, name, sizeof_name, val) 
zend_hash_find(hash, name, sizeof_name, val)
-#endif
-
 #include "zend_multiply.h"

 #if HAVE_ARPA_INET_H

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/filter/filter.c branches/PHP_5_2/ext/filter/tests/bug49274.phpt branches/PHP_5_3/ext/filter/filter.c branches/PHP_5_3/ext/filter/tests/bug49274.phpt t

2009-09-05 Thread Pierre-Alain Joye
pajoye   Sat, 05 Sep 2009 17:35:26 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288083

Log:
- fix #49274, filter_var does not accept object without a toString 
implementation

Bug: http://bugs.php.net/49274 (Analyzed) filter_var() should accept objects 
without fatal error
  
Changed paths:
U   php/php-src/branches/PHP_5_2/ext/filter/filter.c
A   php/php-src/branches/PHP_5_2/ext/filter/tests/bug49274.phpt
U   php/php-src/branches/PHP_5_3/ext/filter/filter.c
A   php/php-src/branches/PHP_5_3/ext/filter/tests/bug49274.phpt
U   php/php-src/trunk/ext/filter/filter.c
A   php/php-src/trunk/ext/filter/tests/bug49274.phpt

Modified: php/php-src/branches/PHP_5_2/ext/filter/filter.c
===
--- php/php-src/branches/PHP_5_2/ext/filter/filter.c2009-09-05 17:11:44 UTC 
(rev 288082)
+++ php/php-src/branches/PHP_5_2/ext/filter/filter.c2009-09-05 17:35:26 UTC 
(rev 288083)
@@ -316,6 +316,19 @@
if (copy) {
SEPARATE_ZVAL(value);
}
+
+   /* #49274, fatal error with object without a toString method
+ Fails nicely instead of getting a recovarable fatal error. */
+   if (Z_TYPE_PP(value) == IS_OBJECT) {
+   zend_class_entry *ce;
+
+   ce = Z_OBJCE_PP(value);
+   if (!ce->__tostring) {
+   ZVAL_FALSE(*value);
+   return;
+   }
+   }
+
/* Here be strings */
convert_to_string(*value);


Added: php/php-src/branches/PHP_5_2/ext/filter/tests/bug49274.phpt
===
--- php/php-src/branches/PHP_5_2/ext/filter/tests/bug49274.phpt 
(rev 0)
+++ php/php-src/branches/PHP_5_2/ext/filter/tests/bug49274.phpt 2009-09-05 
17:35:26 UTC (rev 288083)
@@ -0,0 +1,10 @@
+--TEST--
+#49274, fatal error when an object does not implement toString
+--SKIPIF--
+
+--FILE--
+
+--EXPECTF--
+bool(false)

Modified: php/php-src/branches/PHP_5_3/ext/filter/filter.c
===
--- php/php-src/branches/PHP_5_3/ext/filter/filter.c2009-09-05 17:11:44 UTC 
(rev 288082)
+++ php/php-src/branches/PHP_5_3/ext/filter/filter.c2009-09-05 17:35:26 UTC 
(rev 288083)
@@ -365,6 +365,19 @@
if (copy) {
SEPARATE_ZVAL(value);
}
+
+   /* #49274, fatal error with object without a toString method
+ Fails nicely instead of getting a recovarable fatal error. */
+   if (Z_TYPE_PP(value) == IS_OBJECT) {
+   zend_class_entry *ce;
+
+   ce = Z_OBJCE_PP(value);
+   if (!ce->__tostring) {
+   ZVAL_FALSE(*value);
+   return;
+   }
+   }
+
/* Here be strings */
convert_to_string(*value);


Added: php/php-src/branches/PHP_5_3/ext/filter/tests/bug49274.phpt
===
--- php/php-src/branches/PHP_5_3/ext/filter/tests/bug49274.phpt 
(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/filter/tests/bug49274.phpt 2009-09-05 
17:35:26 UTC (rev 288083)
@@ -0,0 +1,10 @@
+--TEST--
+#49274, fatal error when an object does not implement toString
+--SKIPIF--
+
+--FILE--
+
+--EXPECTF--
+bool(false)

Modified: php/php-src/trunk/ext/filter/filter.c
===
--- php/php-src/trunk/ext/filter/filter.c   2009-09-05 17:11:44 UTC (rev 
288082)
+++ php/php-src/trunk/ext/filter/filter.c   2009-09-05 17:35:26 UTC (rev 
288083)
@@ -379,6 +379,19 @@
if (copy) {
SEPARATE_ZVAL(value);
}
+
+   /* #49274, fatal error with object without a toString method
+ Fails nicely instead of getting a recovarable fatal error. */
+   if (Z_TYPE_PP(value) == IS_OBJECT) {
+   zend_class_entry *ce;
+
+   ce = Z_OBJCE_PP(value);
+   if (!ce->__tostring) {
+   ZVAL_FALSE(*value);
+   return;
+   }
+   }
+
/* Here be strings */
convert_to_string(*value);


Added: php/php-src/trunk/ext/filter/tests/bug49274.phpt
===
--- php/php-src/trunk/ext/filter/tests/bug49274.phpt
(rev 0)
+++ php/php-src/trunk/ext/filter/tests/bug49274.phpt2009-09-05 17:35:26 UTC 
(rev 288083)
@@ -0,0 +1,10 @@
+--TEST--
+#49274, fatal error when an object does not implement toString
+--SKIPIF--
+
+--FILE--
+
+--EXPECTF--
+bool(false)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/Zend/ zend_object_handlers.c

2009-09-05 Thread Jani Taskinen
jani Sat, 05 Sep 2009 17:11:44 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288082

Log:
- This was not supposed to be committed..

Changed paths:
U   php/php-src/branches/PHP_5_2/Zend/zend_object_handlers.c

Modified: php/php-src/branches/PHP_5_2/Zend/zend_object_handlers.c
===
--- php/php-src/branches/PHP_5_2/Zend/zend_object_handlers.c2009-09-05 
17:07:14 UTC (rev 288081)
+++ php/php-src/branches/PHP_5_2/Zend/zend_object_handlers.c2009-09-05 
17:11:44 UTC (rev 288082)
@@ -569,7 +569,7 @@
/* we don't have access controls - will just add it */
new_zval = &EG(uninitialized_zval);

-   zend_error(E_NOTICE, "Undefined property: %s", 
Z_STRVAL_P(member));
+/* zend_error(E_NOTICE, "Undefined property: %s", 
Z_STRVAL_P(member)); */
new_zval->refcount++;
zend_hash_quick_update(zobj->properties, 
property_info->name, property_info->name_length+1, property_info->h, &new_zval, 
sizeof(zval *), (void **) &retval);
} else {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/Zend/zend_object_handlers.c branches/PHP_5_3/NEWS branches/PHP_5_3/main/fopen_wrappers.c branches/PHP_5_3/sapi/cgi/cgi_main.c trunk/main/fopen_wrappers.c

2009-09-05 Thread Jani Taskinen
jani Sat, 05 Sep 2009 17:07:14 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288081

Log:
- Fixed bug #49182 (PHP CGI always outputs the shebang line)

Bug: http://bugs.php.net/49182 (Assigned) PHP CGI always outputs the shebang 
line
  
Changed paths:
U   php/php-src/branches/PHP_5_2/Zend/zend_object_handlers.c
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/main/fopen_wrappers.c
U   php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c
U   php/php-src/trunk/main/fopen_wrappers.c
U   php/php-src/trunk/sapi/cgi/cgi_main.c

Modified: php/php-src/branches/PHP_5_2/Zend/zend_object_handlers.c
===
--- php/php-src/branches/PHP_5_2/Zend/zend_object_handlers.c	2009-09-05 16:50:38 UTC (rev 288080)
+++ php/php-src/branches/PHP_5_2/Zend/zend_object_handlers.c	2009-09-05 17:07:14 UTC (rev 288081)
@@ -569,7 +569,7 @@
 			/* we don't have access controls - will just add it */
 			new_zval = &EG(uninitialized_zval);

-/* 			zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member)); */
+			zend_error(E_NOTICE, "Undefined property: %s", Z_STRVAL_P(member));
 			new_zval->refcount++;
 			zend_hash_quick_update(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, &new_zval, sizeof(zval *), (void **) &retval);
 		} else {

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS	2009-09-05 16:50:38 UTC (rev 288080)
+++ php/php-src/branches/PHP_5_3/NEWS	2009-09-05 17:07:14 UTC (rev 288081)
@@ -2,6 +2,10 @@
 |||
 ?? ??? 2009, PHP 5.3.2

+?? ??? 2009, PHP 5.3.1RC?
+- Restored shebang line check to CGI sapi (not checked by scanner anymore).
+  (Jani)
+
 ?? ??? 2009, PHP 5.3.1
 - Upgraded bundled sqlite to version 3.6.17. (Scott)


Modified: php/php-src/branches/PHP_5_3/main/fopen_wrappers.c
===
--- php/php-src/branches/PHP_5_3/main/fopen_wrappers.c	2009-09-05 16:50:38 UTC (rev 288080)
+++ php/php-src/branches/PHP_5_3/main/fopen_wrappers.c	2009-09-05 17:07:14 UTC (rev 288081)
@@ -382,9 +382,12 @@
  */
 PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle TSRMLS_DC)
 {
+	FILE *fp;
+#ifndef PHP_WIN32
+	struct stat st;
+#endif
 	char *path_info, *filename;
 	int length;
-	zend_bool orig_display_errors;

 	filename = SG(request_info).path_translated;
 	path_info = SG(request_info).request_uri;
@@ -451,7 +454,7 @@
 		}
 	} /* if doc_root && path_info */

-	if(filename) {
+	if (filename) {
 		filename = zend_resolve_path(filename, strlen(filename) TSRMLS_CC);
 	}

@@ -463,21 +466,32 @@
 		STR_FREE(SG(request_info).path_translated);
 		SG(request_info).path_translated = NULL;
 		return FAILURE;
-	} else {
-		STR_FREE(SG(request_info).path_translated);
-		SG(request_info).path_translated = filename;
 	}
+	fp = VCWD_FOPEN(filename, "rb");

-	orig_display_errors = PG(display_errors);
-	PG(display_errors) = 0;
-	if (zend_stream_open(filename, file_handle TSRMLS_CC) == FAILURE) {
-		PG(display_errors) = orig_display_errors;
+#ifndef PHP_WIN32
+	/* refuse to open anything that is not a regular file */
+	if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) {
+		fclose(fp);
+		fp = NULL;
+	}
+#endif
+
+	if (!fp) {
 		STR_FREE(SG(request_info).path_translated);	/* for same reason as above */
 		SG(request_info).path_translated = NULL;
 		return FAILURE;
 	}
-	PG(display_errors) = orig_display_errors;

+	file_handle->opened_path = expand_filepath(filename, NULL TSRMLS_CC);
+
+	SG(request_info).path_translated = filename;
+
+	file_handle->filename = SG(request_info).path_translated;
+	file_handle->free_filename = 0;
+	file_handle->handle.fp = fp;
+	file_handle->type = ZEND_HANDLE_FP;
+
 	return SUCCESS;
 }
 /* }}} */

Modified: php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c
===
--- php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c	2009-09-05 16:50:38 UTC (rev 288080)
+++ php/php-src/branches/PHP_5_3/sapi/cgi/cgi_main.c	2009-09-05 17:07:14 UTC (rev 288081)
@@ -159,6 +159,7 @@
 typedef struct _php_cgi_globals_struct {
 	zend_bool rfc2616_headers;
 	zend_bool nph;
+	zend_bool check_shebang_line;
 	zend_bool fix_pathinfo;
 	zend_bool force_redirect;
 	zend_bool discard_path;
@@ -1369,6 +1370,7 @@
 PHP_INI_BEGIN()
 	STD_PHP_INI_ENTRY("cgi.rfc2616_headers", "0",  PHP_INI_ALL,OnUpdateBool,   rfc2616_headers, php_cgi_globals_struct, php_cgi_globals)
 	STD_PHP_INI_ENTRY("cgi.nph", "0",  PHP_INI_ALL,OnUpdateBool,   nph, php_cgi_globals_struct, php_cgi_globals)
+	STD_PHP_INI_ENTRY("cgi.check_shebang_line",  "1",  PHP_INI_SYSTEM, OnUpdateBool,   check_shebang_line, php_cgi_globals_struct, php_cgi_globals)
 	STD_