[PHP-CVS] svn: /php/php-src/branches/ PHP_5_3/ext/standard/basic_functions.c PHP_5_4/ext/standard/basic_functions.c

2011-09-26 Thread Pierre Joye
pajoye   Mon, 26 Sep 2011 08:36:33 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=317304

Log:
- Fix bug #55622, better fix for this issue, old fix can break if 
sizeof(size_t)  sizeof(int) like on sparc

Bug: https://bugs.php.net/55622 (error getting bug information)
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-26 
08:24:46 UTC (rev 317303)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-26 
08:36:33 UTC (rev 317304)
@@ -6022,7 +6022,7 @@
 PHP_FUNCTION(parse_ini_string)
 {
char *string = NULL, *str = NULL;
-   size_t str_len = 0;
+   int str_len = 0;
zend_bool process_sections = 0;
long scanner_mode = ZEND_INI_SCANNER_NORMAL;
zend_ini_parser_cb_t ini_parser_cb;
@@ -6031,6 +6031,10 @@
RETURN_FALSE;
}

+   if (INT_MAX - str_len  ZEND_MMAP_AHEAD) {
+   RETVAL_FALSE;
+   }
+
/* Set callback function */
if (process_sections) {
BG(active_ini_file_section) = NULL;

Modified: php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-09-26 
08:24:46 UTC (rev 317303)
+++ php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-09-26 
08:36:33 UTC (rev 317304)
@@ -3989,7 +3989,13 @@

ptr = emalloc(size);
size = GetEnvironmentVariableA(str, ptr, size);
-   RETURN_STRING(ptr, 0);
+   if (size == 0) {
+   /* has been removed between the two calls */
+   efree(ptr);
+   RETURN_EMPTY_STRING();
+   } else {
+   RETURN_STRING(ptr, 0);
+   }
}
 #else
/* system method returns a const */
@@ -5930,7 +5936,7 @@
 PHP_FUNCTION(parse_ini_string)
 {
char *string = NULL, *str = NULL;
-   size_t str_len = 0;
+   int str_len = 0;
zend_bool process_sections = 0;
long scanner_mode = ZEND_INI_SCANNER_NORMAL;
zend_ini_parser_cb_t ini_parser_cb;
@@ -5939,6 +5945,10 @@
RETURN_FALSE;
}

+   if (INT_MAX - str_len  ZEND_MMAP_AHEAD) {
+   RETVAL_FALSE;
+   }
+
/* Set callback function */
if (process_sections) {
BG(active_ini_file_section) = 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_3/ext/standard/basic_functions.c branches/PHP_5_4/main/php_ini.c trunk/ext/standard/basic_functions.c

2011-09-26 Thread Pierre Joye
pajoye   Mon, 26 Sep 2011 08:49:28 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=317306

Log:
- be sure to check if the var ha not been removed between the two calls

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/branches/PHP_5_4/main/php_ini.c
U   php/php-src/trunk/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-26 
08:38:03 UTC (rev 317305)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-26 
08:49:28 UTC (rev 317306)
@@ -4022,7 +4022,13 @@

ptr = emalloc(size);
size = GetEnvironmentVariableA(str, ptr, size);
-   RETURN_STRING(ptr, 0);
+   if (size == 0) {
+   /* has been removed between the two calls */
+   efree(ptr);
+   RETURN_EMPTY_STRING();
+   } else {
+   RETURN_STRING(ptr, 0);
+   }
}
 #else
/* system method returns a const */

Modified: php/php-src/branches/PHP_5_4/main/php_ini.c
===
--- php/php-src/branches/PHP_5_4/main/php_ini.c 2011-09-26 08:38:03 UTC (rev 
317305)
+++ php/php-src/branches/PHP_5_4/main/php_ini.c 2011-09-26 08:49:28 UTC (rev 
317306)
@@ -421,7 +421,11 @@
env_location = ;
} else {
size = GetEnvironmentVariableA(PHPRC, 
phprc_path, size);
-   env_location = phprc_path;
+   if (size == 0) {
+   env_location = ;
+   } else {
+   env_location = phprc_path;
+   }
}
}
}

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2011-09-26 08:38:03 UTC 
(rev 317305)
+++ php/php-src/trunk/ext/standard/basic_functions.c2011-09-26 08:49:28 UTC 
(rev 317306)
@@ -4024,7 +4024,13 @@

ptr = emalloc(size);
size = GetEnvironmentVariableA(str, ptr, size);
-   RETURN_STRING(ptr, 0);
+   if (size == 0) {
+   /* has been removed between the two calls */
+   efree(ptr);
+   RETURN_EMPTY_STRING();
+   } else {
+   RETURN_STRING(ptr, 0);
+   }
}
 #else
/* system method returns a const */

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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/basic_functions.c branches/PHP_5_4/main/php_ini.c trunk/ext/standard/basic_functions.c

2011-09-26 Thread Hannes Magnusson
On Mon, Sep 26, 2011 at 10:49, Pierre Joye paj...@php.net wrote:
 pajoye                                   Mon, 26 Sep 2011 08:49:28 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=317306

 Log:
 - be sure to check if the var ha not been removed between the two calls

 Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
    U   php/php-src/branches/PHP_5_4/main/php_ini.c
    U   php/php-src/trunk/ext/standard/basic_functions.c


That was very weird commit..
Are you sure you merged it between the branches right?

-Hannes

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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/basic_functions.c branches/PHP_5_4/main/php_ini.c trunk/ext/standard/basic_functions.c

2011-09-26 Thread Pierre Joye
yes, another commit has been done at the same time by mistake, I added
a comment about that in the respective bug report.

Cheers,

On Mon, Sep 26, 2011 at 2:30 PM, Hannes Magnusson
hannes.magnus...@gmail.com wrote:
 On Mon, Sep 26, 2011 at 10:49, Pierre Joye paj...@php.net wrote:
 pajoye                                   Mon, 26 Sep 2011 08:49:28 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=317306

 Log:
 - be sure to check if the var ha not been removed between the two calls

 Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
    U   php/php-src/branches/PHP_5_4/main/php_ini.c
    U   php/php-src/trunk/ext/standard/basic_functions.c


 That was very weird commit..
 Are you sure you merged it between the branches right?

 -Hannes




-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

--
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/basic_functions.c branches/PHP_5_4/ext/standard/basic_functions.c trunk/ext/standard/basic_functions.c

2011-09-06 Thread Pierre Joye
pajoye   Tue, 06 Sep 2011 17:41:08 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=316285

Log:
- fix #55622, mem corruption on large input

Bug: https://bugs.php.net/55622 (error getting bug information)
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c
U   php/php-src/trunk/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-06 
17:10:16 UTC (rev 316284)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-09-06 
17:41:08 UTC (rev 316285)
@@ -6022,7 +6022,7 @@
 PHP_FUNCTION(parse_ini_string)
 {
char *string = NULL, *str = NULL;
-   int str_len = 0;
+   size_t str_len = 0;
zend_bool process_sections = 0;
long scanner_mode = ZEND_INI_SCANNER_NORMAL;
zend_ini_parser_cb_t ini_parser_cb;

Modified: php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-09-06 
17:10:16 UTC (rev 316284)
+++ php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-09-06 
17:41:08 UTC (rev 316285)
@@ -5903,7 +5903,7 @@
 PHP_FUNCTION(parse_ini_string)
 {
char *string = NULL, *str = NULL;
-   int str_len = 0;
+   size_t str_len = 0;
zend_bool process_sections = 0;
long scanner_mode = ZEND_INI_SCANNER_NORMAL;
zend_ini_parser_cb_t ini_parser_cb;

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2011-09-06 17:10:16 UTC 
(rev 316284)
+++ php/php-src/trunk/ext/standard/basic_functions.c2011-09-06 17:41:08 UTC 
(rev 316285)
@@ -5938,7 +5938,7 @@
 PHP_FUNCTION(parse_ini_string)
 {
char *string = NULL, *str = NULL;
-   int str_len = 0;
+   size_t str_len = 0;
zend_bool process_sections = 0;
long scanner_mode = ZEND_INI_SCANNER_NORMAL;
zend_ini_parser_cb_t ini_parser_cb;

-- 
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/basic_functions.c branches/PHP_5_4/ext/standard/basic_functions.c trunk/ext/standard/basic_functions.c

2011-08-07 Thread Xinchen Hui
laruence Sun, 07 Aug 2011 13:19:04 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=314422

Log:
Fixed bug that may dereferenced NULL pointer before checking

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c
U   php/php-src/trunk/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-08-07 
13:10:10 UTC (rev 314421)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-08-07 
13:19:04 UTC (rev 314422)
@@ -4313,15 +4313,15 @@
/* the first len slots are filled by the one short ops
 * we now extend our array and jump to the new added structs */
opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len 
+ count + 1));
+   if (!opts) {
+   RETURN_FALSE;
+   }
+
orig_opts = opts;
opts += len;

memset(opts, 0, count * sizeof(opt_struct));

-   if (!opts) {
-   RETURN_FALSE;
-   }
-
/* Reset the array indexes. */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));

@@ -4358,6 +4358,10 @@
}
} else {
opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 
1));
+   if (!opts) {
+   RETURN_FALSE;
+   }
+
orig_opts = opts;
opts += len;
}

Modified: php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-08-07 
13:10:10 UTC (rev 314421)
+++ php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-08-07 
13:19:04 UTC (rev 314422)
@@ -4252,15 +4252,15 @@
/* the first len slots are filled by the one short ops
 * we now extend our array and jump to the new added structs */
opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len 
+ count + 1));
+   if (!opts) {
+   RETURN_FALSE;
+   }
+
orig_opts = opts;
opts += len;

memset(opts, 0, count * sizeof(opt_struct));

-   if (!opts) {
-   RETURN_FALSE;
-   }
-
/* Reset the array indexes. */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));

@@ -4297,6 +4297,10 @@
}
} else {
opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 
1));
+   if (!opts) {
+   RETURN_FALSE;
+   }
+
orig_opts = opts;
opts += len;
}

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2011-08-07 13:10:10 UTC 
(rev 314421)
+++ php/php-src/trunk/ext/standard/basic_functions.c2011-08-07 13:19:04 UTC 
(rev 314422)
@@ -4282,15 +4282,15 @@
/* the first len slots are filled by the one short ops
 * we now extend our array and jump to the new added structs */
opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len 
+ count + 1));
+   if (!opts) {
+   RETURN_FALSE;
+   }
+
orig_opts = opts;
opts += len;

memset(opts, 0, count * sizeof(opt_struct));

-   if (!opts) {
-   RETURN_FALSE;
-   }
-
/* Reset the array indexes. */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));

@@ -4327,6 +4327,10 @@
}
} else {
opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 
1));
+   if (!opts) {
+   RETURN_FALSE;
+   }
+
orig_opts = opts;
opts += len;
}

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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/basic_functions.c branches/PHP_5_4/ext/standard/basic_functions.c trunk/ext/standard/basic_functions.c

2011-08-07 Thread Antony Dovgal

On 08/07/2011 05:19 PM, Xinchen Hui wrote:

opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len 
+ count + 1));
+   if (!opts) {
+   RETURN_FALSE;
+   }
+


erealloc() cannot return NULL whatever happens and if you look at the sources, 
you'll notice that nobody
ever checks the result of emalloc(), erealloc() or ecalloc().
That's because Zend memory manager shuts down the whole process if it fails to 
allocate a memory segment.
See Zend/zend_alloc.c for details.

--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime profiling for PHP

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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/basic_functions.c branches/PHP_5_4/ext/standard/basic_functions.c trunk/ext/standard/basic_functions.c

2011-08-07 Thread Pierre Joye
We however have plenty of realloc calls without any checks.

Cheers,

On Sun, Aug 7, 2011 at 3:50 PM, Antony Dovgal t...@daylessday.org wrote:
 On 08/07/2011 05:19 PM, Xinchen Hui wrote:

                opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) *
 (len + count + 1));
 +               if (!opts) {
 +                       RETURN_FALSE;
 +               }
 +

 erealloc() cannot return NULL whatever happens and if you look at the
 sources, you'll notice that nobody
 ever checks the result of emalloc(), erealloc() or ecalloc().
 That's because Zend memory manager shuts down the whole process if it fails
 to allocate a memory segment.
 See Zend/zend_alloc.c for details.

 --
 Wbr,
 Antony Dovgal
 ---
 http://pinba.org - realtime profiling for PHP

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





-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/basic_functions.c branches/PHP_5_4/ext/standard/basic_functions.c trunk/ext/standard/basic_functions.c

2011-08-07 Thread Antony Dovgal

On 08/07/2011 06:16 PM, Laruence wrote:

Hi:
oh,  sorry for mis-understanding,

I will revert these changes.


You can leave it as it is now, I believe.
Just don't waste your time on such checks.

--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime profiling for PHP

--
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/basic_functions.c branches/PHP_5_4/ext/standard/basic_functions.c trunk/ext/standard/basic_functions.c

2011-08-07 Thread Xinchen Hui
laruence Sun, 07 Aug 2011 14:25:30 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=314425

Log:
revert -r314422

No need to check erealloc's return

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c
U   php/php-src/trunk/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-08-07 
14:04:31 UTC (rev 314424)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-08-07 
14:25:30 UTC (rev 314425)
@@ -4313,15 +4313,15 @@
/* the first len slots are filled by the one short ops
 * we now extend our array and jump to the new added structs */
opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len 
+ count + 1));
-   if (!opts) {
-   RETURN_FALSE;
-   }
-
orig_opts = opts;
opts += len;

memset(opts, 0, count * sizeof(opt_struct));

+   if (!opts) {
+   RETURN_FALSE;
+   }
+
/* Reset the array indexes. */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));

@@ -4358,10 +4358,6 @@
}
} else {
opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 
1));
-   if (!opts) {
-   RETURN_FALSE;
-   }
-
orig_opts = opts;
opts += len;
}

Modified: php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-08-07 
14:04:31 UTC (rev 314424)
+++ php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-08-07 
14:25:30 UTC (rev 314425)
@@ -4252,15 +4252,15 @@
/* the first len slots are filled by the one short ops
 * we now extend our array and jump to the new added structs */
opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len 
+ count + 1));
-   if (!opts) {
-   RETURN_FALSE;
-   }
-
orig_opts = opts;
opts += len;

memset(opts, 0, count * sizeof(opt_struct));

+   if (!opts) {
+   RETURN_FALSE;
+   }
+
/* Reset the array indexes. */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));

@@ -4297,10 +4297,6 @@
}
} else {
opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 
1));
-   if (!opts) {
-   RETURN_FALSE;
-   }
-
orig_opts = opts;
opts += len;
}

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2011-08-07 14:04:31 UTC 
(rev 314424)
+++ php/php-src/trunk/ext/standard/basic_functions.c2011-08-07 14:25:30 UTC 
(rev 314425)
@@ -4282,15 +4282,15 @@
/* the first len slots are filled by the one short ops
 * we now extend our array and jump to the new added structs */
opts = (opt_struct *) erealloc(opts, sizeof(opt_struct) * (len 
+ count + 1));
-   if (!opts) {
-   RETURN_FALSE;
-   }
-
orig_opts = opts;
opts += len;

memset(opts, 0, count * sizeof(opt_struct));

+   if (!opts) {
+   RETURN_FALSE;
+   }
+
/* Reset the array indexes. */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));

@@ -4327,10 +4327,6 @@
}
} else {
opts = (opt_struct*) erealloc(opts, sizeof(opt_struct) * (len + 
1));
-   if (!opts) {
-   RETURN_FALSE;
-   }
-
orig_opts = opts;
opts += len;
}

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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/basic_functions.c branches/PHP_5_4/ext/standard/basic_functions.c trunk/ext/standard/basic_functions.c

2011-08-07 Thread Stas Malyshev

Hi!

On 8/7/11 7:25 AM, Xinchen Hui wrote:

laruence Sun, 07 Aug 2011 14:25:30 +
memset(opts, 0, count * sizeof(opt_struct));

+   if (!opts) {
+   RETURN_FALSE;
+   }
+


I'm not sure I understand this code. You first use opts as memset target 
and then check if for null. How that works?

--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

--
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/basic_functions.c branches/PHP_5_4/ext/standard/basic_functions.c trunk/ext/standard/basic_functions.c

2011-08-07 Thread Xinchen Hui
laruence Mon, 08 Aug 2011 00:47:40 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=314452

Log:
Remove no sense statements

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c
U   php/php-src/trunk/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-08-08 
00:07:54 UTC (rev 314451)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-08-08 
00:47:40 UTC (rev 314452)
@@ -4318,10 +4318,6 @@

memset(opts, 0, count * sizeof(opt_struct));

-   if (!opts) {
-   RETURN_FALSE;
-   }
-
/* Reset the array indexes. */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));


Modified: php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-08-08 
00:07:54 UTC (rev 314451)
+++ php/php-src/branches/PHP_5_4/ext/standard/basic_functions.c 2011-08-08 
00:47:40 UTC (rev 314452)
@@ -4257,10 +4257,6 @@

memset(opts, 0, count * sizeof(opt_struct));

-   if (!opts) {
-   RETURN_FALSE;
-   }
-
/* Reset the array indexes. */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));


Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2011-08-08 00:07:54 UTC 
(rev 314451)
+++ php/php-src/trunk/ext/standard/basic_functions.c2011-08-08 00:47:40 UTC 
(rev 314452)
@@ -4287,10 +4287,6 @@

memset(opts, 0, count * sizeof(opt_struct));

-   if (!opts) {
-   RETURN_FALSE;
-   }
-
/* Reset the array indexes. */
zend_hash_internal_pointer_reset(Z_ARRVAL_P(p_longopts));


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

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/standard/basic_functions.c branches/PHP_5_4/ext/standard/basic_functions.c trunk/ext/standard/basic_functions.c

2011-08-07 Thread Laruence
Hi:
   This was what it was before I edit it. I also don't very sure about it.

   and after tracking, I found this statements was introduced in -r243300

   diff: 
http://svn.php.net/viewvc/php/php-src/trunk/ext/standard/basic_functions.c?r1=243098r2=243300

   looks like it was wrong in the rewrite phase,,

   I have delete these no sense statements..


thanks
2011/8/8 Stas Malyshev smalys...@sugarcrm.com:
 Hi!

 On 8/7/11 7:25 AM, Xinchen Hui wrote:

 laruence                                 Sun, 07 Aug 2011 14:25:30 +
                memset(opts, 0, count * sizeof(opt_struct));

 +               if (!opts) {
 +                       RETURN_FALSE;
 +               }
 +

 I'm not sure I understand this code. You first use opts as memset target and
 then check if for null. How that works?
 --
 Stanislav Malyshev, Software Architect
 SugarCRM: http://www.sugarcrm.com/
 (408)454-6900 ext. 227




-- 
Laruence  Xinchen Hui
http://www.laruence.com/

--
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/ basic_functions.c

2011-06-23 Thread Felipe Pena
felipe   Thu, 23 Jun 2011 21:48:15 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=312417

Log:
- Fixed crash in error_log() (strlen(NULL)) reported by: shm, Maksymilian 
Arciemowicz

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-06-23 
21:45:31 UTC (rev 312416)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-06-23 
21:48:15 UTC (rev 312417)
@@ -4678,7 +4678,7 @@
opt_err = erropt;
}

-   if (opt_err == 3) {
+   if (opt_err == 3  opt) {
if (strlen(opt) != opt_len) {
RETURN_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_3/ext/standard/ basic_functions.c http.c php_http.h url.h

2011-01-12 Thread Stanislav Malyshev
stas Thu, 13 Jan 2011 07:27:46 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307432

Log:
revert non-BC change in 5.3

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/branches/PHP_5_3/ext/standard/http.c
U   php/php-src/branches/PHP_5_3/ext/standard/php_http.h
U   php/php-src/branches/PHP_5_3/ext/standard/url.h

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-01-13 
06:53:09 UTC (rev 307431)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-01-13 
07:27:46 UTC (rev 307432)
@@ -1516,7 +1516,6 @@
ZEND_ARG_INFO(0, formdata)
ZEND_ARG_INFO(0, prefix)
ZEND_ARG_INFO(0, arg_separator)
-   ZEND_ARG_INFO(0, enc_type)
 ZEND_END_ARG_INFO()
 /* }}} */
 /* {{{ image.c */
@@ -3576,8 +3575,6 @@
REGISTER_LONG_CONSTANT(PHP_URL_PATH, PHP_URL_PATH, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PHP_URL_QUERY, PHP_URL_QUERY, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PHP_URL_FRAGMENT, PHP_URL_FRAGMENT, CONST_CS | 
CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(PHP_QUERY_RFC1738, PHP_QUERY_RFC1738, CONST_CS 
| CONST_PERSISTENT);
-   REGISTER_LONG_CONSTANT(PHP_QUERY_RFC3986, PHP_QUERY_RFC3986, CONST_CS 
| CONST_PERSISTENT);

 #define REGISTER_MATH_CONSTANT(x)  REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | 
CONST_PERSISTENT)
REGISTER_MATH_CONSTANT(M_E);

Modified: php/php-src/branches/PHP_5_3/ext/standard/http.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/http.c2011-01-13 06:53:09 UTC 
(rev 307431)
+++ php/php-src/branches/PHP_5_3/ext/standard/http.c2011-01-13 07:27:46 UTC 
(rev 307432)
@@ -29,7 +29,7 @@
const char *num_prefix, int num_prefix_len,
const char *key_prefix, int key_prefix_len,
const char *key_suffix, int key_suffix_len,
-   zval *type, char *arg_sep, int enc_type 
TSRMLS_DC)
+   zval *type, char *arg_sep TSRMLS_DC)
 {
char *key = NULL, *ekey, *newprefix, *p;
int arg_sep_len, key_len, ekey_len, key_type, newprefix_len;
@@ -81,11 +81,7 @@
}
if (Z_TYPE_PP(zdata) == IS_ARRAY || Z_TYPE_PP(zdata) == 
IS_OBJECT) {
if (key_type == HASH_KEY_IS_STRING) {
-   if (enc_type == PHP_QUERY_RFC3986) {
-   ekey = php_raw_url_encode(key, key_len, 
ekey_len);
-   } else {
-   ekey = php_url_encode(key, key_len, 
ekey_len);
-   }
+   ekey = php_url_encode(key, key_len, ekey_len);
newprefix_len = key_suffix_len + ekey_len + 
key_prefix_len + 3 /* %5B */;
newprefix = emalloc(newprefix_len + 1);
p = newprefix;
@@ -136,7 +132,7 @@
*p = '\0';
}
ht-nApplyCount++;
-   php_url_encode_hash_ex(HASH_OF(*zdata), formstr, NULL, 
0, newprefix, newprefix_len, %5D, 3, (Z_TYPE_PP(zdata) == IS_OBJECT ? *zdata 
: NULL), arg_sep, enc_type TSRMLS_CC);
+   php_url_encode_hash_ex(HASH_OF(*zdata), formstr, NULL, 
0, newprefix, newprefix_len, %5D, 3, (Z_TYPE_PP(zdata) == IS_OBJECT ? *zdata 
: NULL), arg_sep TSRMLS_CC);
ht-nApplyCount--;
efree(newprefix);
} else if (Z_TYPE_PP(zdata) == IS_NULL || Z_TYPE_PP(zdata) == 
IS_RESOURCE) {
@@ -149,11 +145,7 @@
/* Simple key=value */
smart_str_appendl(formstr, key_prefix, key_prefix_len);
if (key_type == HASH_KEY_IS_STRING) {
-   if (enc_type == PHP_QUERY_RFC3986) {
-   ekey = php_raw_url_encode(key, key_len, 
ekey_len);
-   } else {
-   ekey = php_url_encode(key, key_len, 
ekey_len);
-   }
+   ekey = php_url_encode(key, key_len, ekey_len);
smart_str_appendl(formstr, ekey, ekey_len);
efree(ekey);
} else {
@@ -169,11 +161,7 @@
smart_str_appendl(formstr, =, 1);
switch (Z_TYPE_PP(zdata)) {
case IS_STRING:
-   if (enc_type == PHP_QUERY_RFC3986) {
-

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/standard/ basic_functions.c http.c php_http.h url.h

2011-01-10 Thread Pierre Joye
hi,

Yes, it breaks the ABI, please revert this patch.

Maybe another implementation by adding a new function could help, but
I'm not sure we need that now in 5.3 either.

Cheers,

On Mon, Jan 10, 2011 at 5:35 AM, Adam Harvey ahar...@php.net wrote:
 On 8 January 2011 10:34, Rui Hirokawa hirok...@php.net wrote:
 hirokawa                                 Sat, 08 Jan 2011 02:34:33 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=307248

 Log:
 MFH: added an option to http_build_query for RFC-3986
 based url-encoding.

 Somebody should double check me on this, because binary
 compatibility's not one of my stronger points, but isn't the change to
 the php_url_encode_hash_ex() definition going to break BC in 5.3?
 ext/standard/php_http.h is one of the headers we install.

 Adam

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





-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

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



Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/standard/ basic_functions.c http.c php_http.h url.h

2011-01-09 Thread Adam Harvey
On 8 January 2011 10:34, Rui Hirokawa hirok...@php.net wrote:
 hirokawa                                 Sat, 08 Jan 2011 02:34:33 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=307248

 Log:
 MFH: added an option to http_build_query for RFC-3986
 based url-encoding.

Somebody should double check me on this, because binary
compatibility's not one of my stronger points, but isn't the change to
the php_url_encode_hash_ex() definition going to break BC in 5.3?
ext/standard/php_http.h is one of the headers we install.

Adam

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



Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/standard/ basic_functions.c http.c php_http.h url.h

2011-01-09 Thread Kalle Sommer Nielsen
Hi Adam

2011/1/10 Adam Harvey ahar...@php.net:
 On 8 January 2011 10:34, Rui Hirokawa hirok...@php.net wrote:
 hirokawa                                 Sat, 08 Jan 2011 02:34:33 +

 Revision: http://svn.php.net/viewvc?view=revisionrevision=307248

 Log:
 MFH: added an option to http_build_query for RFC-3986
 based url-encoding.

 Somebody should double check me on this, because binary
 compatibility's not one of my stronger points, but isn't the change to
 the php_url_encode_hash_ex() definition going to break BC in 5.3?
 ext/standard/php_http.h is one of the headers we install.

It will break the extensions API, because of extensions compiled for
5.3.5 is used with 5.3.6, then they will fail dynamic linking. I had
to do the same thing when I merged the copy stream context support for
5.3, what I did was:

Added php_copy_stream() which was the implementation of its
counterpart php_copy_ex(), so the API was the same, and added a new
function. I think the same should be done to achieve BC here.

-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

--
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/ basic_functions.c http.c php_http.h url.h

2011-01-07 Thread Rui Hirokawa
hirokawa Sat, 08 Jan 2011 02:34:33 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=307248

Log:
MFH: added an option to http_build_query for RFC-3986
based url-encoding.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/branches/PHP_5_3/ext/standard/http.c
U   php/php-src/branches/PHP_5_3/ext/standard/php_http.h
U   php/php-src/branches/PHP_5_3/ext/standard/url.h

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-01-08 
02:21:44 UTC (rev 307247)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2011-01-08 
02:34:33 UTC (rev 307248)
@@ -1516,6 +1516,7 @@
ZEND_ARG_INFO(0, formdata)
ZEND_ARG_INFO(0, prefix)
ZEND_ARG_INFO(0, arg_separator)
+   ZEND_ARG_INFO(0, enc_type)
 ZEND_END_ARG_INFO()
 /* }}} */
 /* {{{ image.c */
@@ -3575,6 +3576,8 @@
REGISTER_LONG_CONSTANT(PHP_URL_PATH, PHP_URL_PATH, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PHP_URL_QUERY, PHP_URL_QUERY, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PHP_URL_FRAGMENT, PHP_URL_FRAGMENT, CONST_CS | 
CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(PHP_QUERY_RFC1738, PHP_QUERY_RFC1738, CONST_CS 
| CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT(PHP_QUERY_RFC3986, PHP_QUERY_RFC3986, CONST_CS 
| CONST_PERSISTENT);

 #define REGISTER_MATH_CONSTANT(x)  REGISTER_DOUBLE_CONSTANT(#x, x, CONST_CS | 
CONST_PERSISTENT)
REGISTER_MATH_CONSTANT(M_E);

Modified: php/php-src/branches/PHP_5_3/ext/standard/http.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/http.c2011-01-08 02:21:44 UTC 
(rev 307247)
+++ php/php-src/branches/PHP_5_3/ext/standard/http.c2011-01-08 02:34:33 UTC 
(rev 307248)
@@ -29,7 +29,7 @@
const char *num_prefix, int num_prefix_len,
const char *key_prefix, int key_prefix_len,
const char *key_suffix, int key_suffix_len,
-   zval *type, char *arg_sep TSRMLS_DC)
+   zval *type, char *arg_sep, int enc_type 
TSRMLS_DC)
 {
char *key = NULL, *ekey, *newprefix, *p;
int arg_sep_len, key_len, ekey_len, key_type, newprefix_len;
@@ -81,7 +81,11 @@
}
if (Z_TYPE_PP(zdata) == IS_ARRAY || Z_TYPE_PP(zdata) == 
IS_OBJECT) {
if (key_type == HASH_KEY_IS_STRING) {
-   ekey = php_url_encode(key, key_len, ekey_len);
+   if (enc_type == PHP_QUERY_RFC3986) {
+   ekey = php_raw_url_encode(key, key_len, 
ekey_len);
+   } else {
+   ekey = php_url_encode(key, key_len, 
ekey_len);
+   }
newprefix_len = key_suffix_len + ekey_len + 
key_prefix_len + 3 /* %5B */;
newprefix = emalloc(newprefix_len + 1);
p = newprefix;
@@ -132,7 +136,7 @@
*p = '\0';
}
ht-nApplyCount++;
-   php_url_encode_hash_ex(HASH_OF(*zdata), formstr, NULL, 
0, newprefix, newprefix_len, %5D, 3, (Z_TYPE_PP(zdata) == IS_OBJECT ? *zdata 
: NULL), arg_sep TSRMLS_CC);
+   php_url_encode_hash_ex(HASH_OF(*zdata), formstr, NULL, 
0, newprefix, newprefix_len, %5D, 3, (Z_TYPE_PP(zdata) == IS_OBJECT ? *zdata 
: NULL), arg_sep, enc_type TSRMLS_CC);
ht-nApplyCount--;
efree(newprefix);
} else if (Z_TYPE_PP(zdata) == IS_NULL || Z_TYPE_PP(zdata) == 
IS_RESOURCE) {
@@ -145,7 +149,11 @@
/* Simple key=value */
smart_str_appendl(formstr, key_prefix, key_prefix_len);
if (key_type == HASH_KEY_IS_STRING) {
-   ekey = php_url_encode(key, key_len, ekey_len);
+   if (enc_type == PHP_QUERY_RFC3986) {
+   ekey = php_raw_url_encode(key, key_len, 
ekey_len);
+   } else {
+   ekey = php_url_encode(key, key_len, 
ekey_len);
+   }
smart_str_appendl(formstr, ekey, ekey_len);
efree(ekey);
} else {
@@ -161,7 +169,11 @@
smart_str_appendl(formstr, =, 1);
switch (Z_TYPE_PP(zdata)) {
case IS_STRING:
-   

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/standard/ basic_functions.c

2010-08-17 Thread Kalle Sommer Nielsen
kalleTue, 17 Aug 2010 13:34:11 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302389

Log:
Fix my fix for arginfo, trunk patch will follow shortly

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-08-17 
12:57:04 UTC (rev 302388)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-08-17 
13:34:11 UTC (rev 302389)
@@ -1210,7 +1210,7 @@
ZEND_ARG_INFO(0, fp)
 ZEND_END_ARG_INFO()

-ZEND_BEGIN_ARG_INFO(arginfo_copy, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_copy, 0, 0, 2)
ZEND_ARG_INFO(0, source_file)
ZEND_ARG_INFO(0, destination_file)
ZEND_ARG_INFO(0, context)

-- 
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/ basic_functions.c

2010-08-16 Thread Kalle Sommer Nielsen
kalleMon, 16 Aug 2010 21:59:42 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=302377

Log:
Fix arginfo for copy(), see r302376 for more info

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-08-16 
21:56:35 UTC (rev 302376)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-08-16 
21:59:42 UTC (rev 302377)
@@ -1209,9 +1209,11 @@
 ZEND_BEGIN_ARG_INFO(arginfo_fstat, 0)
ZEND_ARG_INFO(0, fp)
 ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO(arginfo_copy, 0)
ZEND_ARG_INFO(0, source_file)
ZEND_ARG_INFO(0, destination_file)
+   ZEND_ARG_INFO(0, context)
 ZEND_END_ARG_INFO()

 ZEND_BEGIN_ARG_INFO(arginfo_fread, 0)

-- 
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/basic_functions.c branches/PHP_5_3/ext/standard/tests/general_functions/bug50690.phpt trunk/ext/standard/basic_functions.c trunk/ext/standard

2010-01-24 Thread Pierre Joye
pajoye   Sun, 24 Jan 2010 13:49:47 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=293902

Log:
- #50690, putenv does assign value when their length is one char

Bug: http://bugs.php.net/50690 (Assigned) putenv() does not assign values to 
env. vars when the value is one character
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
A   
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50690.phpt
U   php/php-src/trunk/ext/standard/basic_functions.c
A   php/php-src/trunk/ext/standard/tests/general_functions/bug50690.phpt

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-01-24 
13:36:08 UTC (rev 293901)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-01-24 
13:49:47 UTC (rev 293902)
@@ -4056,7 +4056,7 @@
pe.key_len = strlen(pe.key);
 #ifdef PHP_WIN32
if (equals) {
-   if (pe.key_len  setting_len - 2) {
+   if (pe.key_len  setting_len - 1) {
value = p + 1;
} else {
/* empty string*/

Added: 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50690.phpt
===
--- 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50690.phpt 
(rev 0)
+++ 
php/php-src/branches/PHP_5_3/ext/standard/tests/general_functions/bug50690.phpt 
2010-01-24 13:49:47 UTC (rev 293902)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #23650 (putenv() does not assign values when the value is one character)
+--FILE--
+?php
+putenv(foo=ab);
+putenv(bar=c);
+var_dump(getenv(foo));
+var_dump(getenv(bar));
+var_dump(getenv(thisvardoesnotexist));
+?
+--EXPECT--
+string(2) ab
+string(1) c
+bool(false)

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2010-01-24 13:36:08 UTC 
(rev 293901)
+++ php/php-src/trunk/ext/standard/basic_functions.c2010-01-24 13:49:47 UTC 
(rev 293902)
@@ -4043,7 +4043,7 @@

 #ifdef PHP_WIN32
if (equals) {
-   if (pe.key_len  setting_len - 2) {
+   if (pe.key_len  setting_len - 1) {
value = p + 1;
} else {
/* empty string*/

Added: php/php-src/trunk/ext/standard/tests/general_functions/bug50690.phpt
===
--- php/php-src/trunk/ext/standard/tests/general_functions/bug50690.phpt
(rev 0)
+++ php/php-src/trunk/ext/standard/tests/general_functions/bug50690.phpt
2010-01-24 13:49:47 UTC (rev 293902)
@@ -0,0 +1,14 @@
+--TEST--
+Bug #23650 (putenv() does not assign values when the value is one character)
+--FILE--
+?php
+putenv(foo=ab);
+putenv(bar=c);
+var_dump(getenv(foo));
+var_dump(getenv(bar));
+var_dump(getenv(thisvardoesnotexist));
+?
+--EXPECT--
+string(2) ab
+string(1) c
+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_3/ext/standard/ basic_functions.c dns.c php_dns.h

2010-01-07 Thread Sebastian Bergmann
sebastianThu, 07 Jan 2010 11:02:39 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=293211

Log:
sed -i s#1997-2008#1997-2010#g **/*.c **/*.h

Bug: http://bugs.php.net/1997 (Bogus) Compilation Problems
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/branches/PHP_5_3/ext/standard/dns.c
U   php/php-src/branches/PHP_5_3/ext/standard/php_dns.h

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-01-07 
10:51:05 UTC (rev 293210)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-01-07 
11:02:39 UTC (rev 293211)
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2008 The PHP Group|
+   | Copyright (c) 1997-2010 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|

Modified: php/php-src/branches/PHP_5_3/ext/standard/dns.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/dns.c 2010-01-07 10:51:05 UTC 
(rev 293210)
+++ php/php-src/branches/PHP_5_3/ext/standard/dns.c 2010-01-07 11:02:39 UTC 
(rev 293211)
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2008 The PHP Group|
+   | Copyright (c) 1997-2010 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|

Modified: php/php-src/branches/PHP_5_3/ext/standard/php_dns.h
===
--- php/php-src/branches/PHP_5_3/ext/standard/php_dns.h 2010-01-07 10:51:05 UTC 
(rev 293210)
+++ php/php-src/branches/PHP_5_3/ext/standard/php_dns.h 2010-01-07 11:02:39 UTC 
(rev 293211)
@@ -2,7 +2,7 @@
+--+
| PHP Version 5|
+--+
-   | Copyright (c) 1997-2008 The PHP Group|
+   | Copyright (c) 1997-2010 The PHP Group|
+--+
| This source file is subject to version 3.01 of the PHP license,  |
| that is bundled with this package in the file LICENSE, and is|

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

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/standard/ basic_functions.c dns.c php_dns.h

2010-01-07 Thread Jani Taskinen

On 01/07/2010 01:02 PM, Sebastian Bergmann wrote:

sebastianThu, 07 Jan 2010 11:02:39 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=293211

Log:
sed -i s#1997-2008#1997-2010#g **/*.c **/*.h

Bug: http://bugs.php.net/1997 (Bogus) Compilation Problems


Why is that commit script picking these without word 'bug' in the commit 
message? Sebastian spammed a few reports now unintentionally..


--Jani





Changed paths:
 U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
 U   php/php-src/branches/PHP_5_3/ext/standard/dns.c
 U   php/php-src/branches/PHP_5_3/ext/standard/php_dns.h

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-01-07 
10:51:05 UTC (rev 293210)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2010-01-07 
11:02:39 UTC (rev 293211)
@@ -2,7 +2,7 @@
 +--+
 | PHP Version 5|
 +--+
-   | Copyright (c) 1997-2008 The PHP Group|
+   | Copyright (c) 1997-2010 The PHP Group|
 +--+
 | This source file is subject to version 3.01 of the PHP license,  |
 | that is bundled with this package in the file LICENSE, and is|

Modified: php/php-src/branches/PHP_5_3/ext/standard/dns.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/dns.c 2010-01-07 10:51:05 UTC 
(rev 293210)
+++ php/php-src/branches/PHP_5_3/ext/standard/dns.c 2010-01-07 11:02:39 UTC 
(rev 293211)
@@ -2,7 +2,7 @@
 +--+
 | PHP Version 5|
 +--+
-   | Copyright (c) 1997-2008 The PHP Group|
+   | Copyright (c) 1997-2010 The PHP Group|
 +--+
 | This source file is subject to version 3.01 of the PHP license,  |
 | that is bundled with this package in the file LICENSE, and is|

Modified: php/php-src/branches/PHP_5_3/ext/standard/php_dns.h
===
--- php/php-src/branches/PHP_5_3/ext/standard/php_dns.h 2010-01-07 10:51:05 UTC 
(rev 293210)
+++ php/php-src/branches/PHP_5_3/ext/standard/php_dns.h 2010-01-07 11:02:39 UTC 
(rev 293211)
@@ -2,7 +2,7 @@
 +--+
 | PHP Version 5|
 +--+
-   | Copyright (c) 1997-2008 The PHP Group|
+   | Copyright (c) 1997-2010 The PHP Group|
 +--+
 | This source file is subject to version 3.01 of the PHP license,  |
 | that is bundled with this package in the file LICENSE, and is|





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



Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/standard/ basic_functions.c dns.c php_dns.h

2010-01-07 Thread Kalle Sommer Nielsen
 Why is that commit script picking these without word 'bug' in the commit
 message? Sebastian spammed a few reports now unintentionally..

I guess its because the commit script also considers #\d as a bug
report. Not just bug #\d

-- 
regrads,

Kalle Sommer Nielsen
ka...@php.net

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



Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/standard/ basic_functions.c dns.c php_dns.h

2010-01-07 Thread Matteo Beccati

Il 07/01/2010 12:12, Jani Taskinen ha scritto:

On 01/07/2010 01:02 PM, Sebastian Bergmann wrote:

sebastian Thu, 07 Jan 2010 11:02:39 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=293211

Log:
sed -i s#1997-2008#1997-2010#g **/*.c **/*.h

Bug: http://bugs.php.net/1997 (Bogus) Compilation Problems


Why is that commit script picking these without word 'bug' in the commit
message? Sebastian spammed a few reports now unintentionally..


I've noticed it before, but forgot to report it. Maybe changing the 
regex in:


http://svn.php.net/viewvc/SVNROOT/commit-bugs.php?revision=284714view=markuppathrev=291593

to:

$bug_pattern = 
'/(?:(pecl|pear|php)\s*)?(?:bug|#)[\s#:]*([0-9]+)(?=\s|$)/iuX';


would do the trick.


Cheers
--
Matteo Beccati

Development  Consulting - http://www.beccati.com/

--
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/basic_functions.c trunk/ext/standard/basic_functions.c

2009-08-12 Thread Scott MacVicar
scottmac Wed, 12 Aug 2009 09:18:41 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=287151

Log:
Fix build on platforms where crypt isn't always available

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
U   php/php-src/trunk/ext/standard/basic_functions.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2009-08-12 
08:40:05 UTC (rev 287150)
+++ php/php-src/branches/PHP_5_3/ext/standard/basic_functions.c 2009-08-12 
09:18:41 UTC (rev 287151)
@@ -3678,7 +3678,9 @@
 #if defined(HAVE_LOCALECONV)  defined(ZTS)
PHP_MSHUTDOWN(localeconv)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
 #endif
+#if HAVE_CRYPT
PHP_MSHUTDOWN(crypt)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
+#endif

return SUCCESS;
 }

Modified: php/php-src/trunk/ext/standard/basic_functions.c
===
--- php/php-src/trunk/ext/standard/basic_functions.c2009-08-12 08:40:05 UTC 
(rev 287150)
+++ php/php-src/trunk/ext/standard/basic_functions.c2009-08-12 09:18:41 UTC 
(rev 287151)
@@ -3671,7 +3671,9 @@
 #if defined(HAVE_LOCALECONV)  defined(ZTS)
PHP_MSHUTDOWN(localeconv)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
 #endif
+#if HAVE_CRYPT
PHP_MSHUTDOWN(crypt)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
+#endif

return SUCCESS;
 }

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