--- /dev/null
+--TEST--
+concat strings
+--FILE--
+<?php
+
+$bin_s = (binary)"binary string";
+$bin_s1 = (binary)"one more bin string";
+
+$uni_s = "test string";
+$uni_s1 = "one more test";
+
+$tmp = $bin_s.$bin_s1;
+var_dump($tmp);
+
+$tmp = $bin_s.$uni_s;
+var_dump($tmp);
+
+$tmp = $uni_s.$uni_s1;
+var_dump($tmp);
+
+$tmp = $uni_s.$bin_s1;
+var_dump($tmp);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(32) "binary stringone more bin string"
+string(24) "binary stringtest string"
+string(24) "test stringone more test"
+string(30) "test stringone more bin string"
+Done
+--UEXPECTF--
+string(32) "binary stringone more bin string"
+unicode(24) "binary stringtest string"
+unicode(24) "test stringone more test"
+unicode(30) "test stringone more bin string"
+Done
ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
zval op1_copy, op2_copy;
- int use_copy1, use_copy2;
+ int use_copy1 = 0, use_copy2 = 0;
zend_uchar result_type;
- if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE || UG(unicode)) {
+ if (Z_TYPE_P(op1) == IS_STRING && Z_TYPE_P(op2) == IS_STRING) {
+ result_type = IS_STRING;
+ } else if (Z_TYPE_P(op1) == IS_UNICODE || Z_TYPE_P(op2) == IS_UNICODE || UG(unicode)) {
zend_make_unicode_zval(op1, &op1_copy, &use_copy1);
zend_make_unicode_zval(op2, &op2_copy, &use_copy2);
result_type = IS_UNICODE;