--- php-5.3.1/ext/standard/string.c	2009-08-31 14:28:46.000000000 +0200
+++ active-3.1/ext/standard/string.c	2009-12-11 20:18:07.000000000 +0100
@@ -5109,33 +5109,94 @@
 	long split_length = 1;
 	char *p;
 	int n_reg_segments;
-	
-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len, &split_length) == FAILURE) {
+	zval *split;
+
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &str, &str_len, &split) == FAILURE) {
 		return;
 	}
 
-	if (split_length <= 0) {
-		php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length of each segment must be greater than zero");
-		RETURN_FALSE;
-	}
+	if (Z_TYPE_P(split) == IS_ARRAY) {
+	
+		zval **d;
+		HashPosition p;
+		HashTable *ht = Z_ARRVAL_P(split);
+		split_length  = zend_hash_num_elements(ht);
 
-	array_init_size(return_value, ((str_len - 1) / split_length) + 1);
+		if (split_length < 1) {
+			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Split sequence array is empty");
+			RETURN_FALSE;
+		}
 
-	if (split_length >= str_len) {
-		add_next_index_stringl(return_value, str, str_len, 1);
-		return;
-	}
+		long prev = -1;
 
-	n_reg_segments = str_len / split_length;
-	p = str;
+		array_init_size(return_value, split_length);
 
-	while (n_reg_segments-- > 0) {
-		add_next_index_stringl(return_value, p, split_length, 1);
-		p += split_length;
-	}
+		for(zend_hash_internal_pointer_reset_ex(ht, &p); 
+		zend_hash_get_current_data_ex(ht, (void**) &d, &p) == SUCCESS; 
+		zend_hash_move_forward_ex(ht, &p)) {
+
+			convert_to_long(*d);
+
+			if (Z_LVAL_PP(d) < 0) {
+				Z_LVAL_PP(d)+= str_len;
+			}
+
+			if (prev != -1 && prev >= Z_LVAL_PP(d) || prev == -1 && Z_LVAL_PP(d) < 0) {
+				php_error_docref(NULL TSRMLS_CC, E_WARNING, "The split sequence should be grow from left to right without overlapping");
+				/* free initialized return_value? */
+				RETURN_FALSE;
+			}
+
+			if (Z_LVAL_PP(d) > str_len) {
+				Z_LVAL_PP(d) = str_len;
+			}
+
+			if (prev == -1) {
+
+				if (Z_LVAL_PP(d) != 0) {
+					add_next_index_stringl(return_value, str, Z_LVAL_PP(d), 1);
+				}
+
+			} else {
+				add_next_index_stringl(return_value, str + prev, Z_LVAL_PP(d) - prev, 1);
+			}
+
+			prev = Z_LVAL_PP(d);
+		}
+
+		if (prev < str_len) {
+			add_next_index_stringl(return_value, str + prev, str_len - prev, 1);
+		}
+	
+	} else {
+
+		convert_to_long(split);
+
+		split_length = Z_LVAL_P(split);
+
+		if (split_length <= 0) {
+			php_error_docref(NULL TSRMLS_CC, E_WARNING, "The length of each segment must be greater than zero");
+			RETURN_FALSE;
+		}
+
+		array_init_size(return_value, ((str_len - 1) / split_length) + 1);
+
+		if (split_length >= str_len) {
+			add_next_index_stringl(return_value, str, str_len, 1);
+			return;
+		}
+
+		n_reg_segments = str_len / split_length;
+		p = str;
+
+		while (n_reg_segments-- > 0) {
+			add_next_index_stringl(return_value, p, split_length, 1);
+			p += split_length;
+		}
 
-	if (p != (str + str_len)) {
-		add_next_index_stringl(return_value, p, (str + str_len - p), 1);
+		if (p != (str + str_len)) {
+			add_next_index_stringl(return_value, p, (str + str_len - p), 1);
+		}
 	}
 }
 /* }}} */
