[PHP-CVS] Re: [PHP-DEV] Re: [PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/standard php_string.h string.c /ext/standard/tests/strings bug47546.phpt

2009-06-12 Thread Richard Quadling
2009/6/12 Michael Wallner m...@php.net:
 Matt Wilmas wrote:
 Hi Dmitry, Antony,

 Fixed, thanks.


 Matt Wilmas wrote:
 mattwil Wed Apr  1 17:05:37 2009 UTC

   Removed files:               (Branch: PHP_5_3)
     /php-src/ext/standard/tests/strings bug47546.phpt
   Modified files:              /php-src NEWS /php-src/ext/standard
 php_string.h string.c Log:
   MFH: explode() stuff:
   - Fixed bug #47560 (explode()'s limit parameter odd behaviour) by
 reverting change for bug #47546


 In what state is this now?

 php_explode() does not work as expected with limit=-1 and
 php_explode_negative_limit() is not exported in php_string.h

 Mike

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php



From a user's perspective, I would say that explode() now works as I
would expect.

When a valid delimiter is supplied with no limit, then the result is
the same as if the limit was the count of items after the split.

For negative limits (with a valid delimiter), the result is chopped by
the abs($limit).

?php
$string = 'one.two.three.four';
$results = array();

foreach(array('Valid' = '.', 'Invalid' = '_') as $valid = $delimiter) {
$results[$valid]['No Limit'] = explode($delimiter, $string);

foreach(range(-4, 4) as $limit) {
$results[$valid][$limit] = explode($delimiter, $string, $limit);
}
}

print_r($results);
?

outputs what I think is correct.

Array
(
[Valid] = Array
(
[No Limit] = Array
(
[0] = one
[1] = two
[2] = three
[3] = four
)
[-4] = Array
(
)
[-3] = Array
(
[0] = one
)
[-2] = Array
(
[0] = one
[1] = two
)
[-1] = Array
(
[0] = one
[1] = two
[2] = three
)
[0] = Array
(
[0] = one.two.three.four
)
[1] = Array
(
[0] = one.two.three.four
)
[2] = Array
(
[0] = one
[1] = two.three.four
)
[3] = Array
(
[0] = one
[1] = two
[2] = three.four
)
[4] = Array
(
[0] = one
[1] = two
[2] = three
[3] = four
)
)
[Invalid] = Array
(
[No Limit] = Array
(
[0] = one.two.three.four
)
[-4] = Array
(
)
[-3] = Array
(
)
[-2] = Array
(
)
[-1] = Array
(
)
[0] = Array
(
[0] = one.two.three.four
)
[1] = Array
(
[0] = one.two.three.four
)
[2] = Array
(
[0] = one.two.three.four
)
[3] = Array
(
[0] = one.two.three.four
)
[4] = Array
(
[0] = one.two.three.four
)
)
)

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-CVS] Re: [PHP-DOC] cvs: php-src(PHP_5_3) /ext/standard file.c

2007-11-06 Thread Richard Quadling
Changelog to read 5.3.0 rather than 5.0

Thanks.

On 06/11/2007, Jani Taskinen [EMAIL PROTECTED] wrote:
 In 5.3.0. I merged it yesterday. It was due for PHP 6.0.0 before.

 --Jani

 On Tue, 2007-11-06 at 10:01 +, Richard Quadling wrote:
  What version was the context param introduced?
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?revision=1.459view=markup
  but I'm not good enough to know what PHP version this is. Sorry.
 
  On 05/11/2007, Jani Taskinen [EMAIL PROTECTED] wrote:
   janiMon Nov  5 17:43:05 2007 UTC
  
 Modified files:  (Branch: PHP_5_3)
   /php-src/ext/standard   file.c
 Log:
 MFH: Sync
 [DOC]: note
 [DOC] -/* {{{ proto bool copy(string source_file, string 
   destination_file)
 [DOC] +/* {{{ proto bool copy(string source_file, string 
   destination_file [, resource context])
 [DOC]
 [DOC] Apparently this was undocumented so far anyway..
  
  
  
 
 
  --
  -
  Richard Quadling
  Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
  Standing on the shoulders of some very clever giants!
 
 --
 Patches/Donations: http://pecl.php.net/~jani/





-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



[PHP-CVS] Re: [PHP-DOC] cvs: php-src(PHP_5_3) /ext/standard file.c

2007-11-06 Thread Richard Quadling
What version was the context param introduced?
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?revision=1.459view=markup
but I'm not good enough to know what PHP version this is. Sorry.

On 05/11/2007, Jani Taskinen [EMAIL PROTECTED] wrote:
 janiMon Nov  5 17:43:05 2007 UTC

   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/standard   file.c
   Log:
   MFH: Sync
   [DOC]: note
   [DOC] -/* {{{ proto bool copy(string source_file, string destination_file)
   [DOC] +/* {{{ proto bool copy(string source_file, string destination_file 
 [, resource context])
   [DOC]
   [DOC] Apparently this was undocumented so far anyway..





-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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