mirror of
https://github.com/php/php-src.git
synced 2025-01-25 21:23:45 +08:00
Fixed wrong fix
This commit is contained in:
parent
f5480b2cb0
commit
9df576bed3
@ -1359,22 +1359,22 @@ PHPAPI PHP_FUNCTION(fwrite)
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
if (write_len <= 0) {
|
||||
php_stream_from_zval(stream, &zstream);
|
||||
|
||||
if (argc > 2 && write_len <= 0) {
|
||||
RETURN_LONG(0);
|
||||
}
|
||||
|
||||
php_stream_from_zval(stream, &zstream);
|
||||
|
||||
if (Z_TYPE_P(zstring) == IS_UNICODE) {
|
||||
if (write_len < 0 || write_len > Z_USTRLEN_P(zstring)) {
|
||||
write_len = Z_USTRLEN_P(zstring);
|
||||
}
|
||||
/* Convert code units to data points */
|
||||
int32_t write_uchars = 0;
|
||||
|
||||
U16_FWD_N(Z_USTRVAL_P(zstring), write_uchars, Z_USTRLEN_P(zstring), write_len);
|
||||
write_len = write_uchars;
|
||||
|
||||
if (write_len > Z_USTRLEN_P(zstring)) {
|
||||
write_len = Z_USTRLEN_P(zstring);
|
||||
}
|
||||
ret = php_stream_write_unicode(stream, Z_USTRVAL_P(zstring), write_len);
|
||||
|
||||
/* Convert data points back to code units */
|
||||
@ -1383,7 +1383,7 @@ PHPAPI PHP_FUNCTION(fwrite)
|
||||
}
|
||||
} else {
|
||||
convert_to_string(zstring);
|
||||
if (write_len > Z_STRLEN_P(zstring)) {
|
||||
if (write_len < 0 || write_len > Z_STRLEN_P(zstring)) {
|
||||
write_len = Z_STRLEN_P(zstring);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user