File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ PHP NEWS
50
50
. Fixed bug GH-15094 (php_random_default_engine() is not C++ conforming).
51
51
(cmb)
52
52
53
+ - Readline:
54
+ . Fixed readline_info, rl_line_buffer_length/rl_len globals on update.
55
+ (David Carlier)
56
+
53
57
- Standard:
54
58
. Fix references in request_parse_body() options array. (nielsdos)
55
59
. Add RoundingMode enum. (timwolla, saki)
Original file line number Diff line number Diff line change @@ -183,11 +183,24 @@ PHP_FUNCTION(readline_info)
183
183
if (zend_string_equals_literal_ci (what ,"line_buffer" )) {
184
184
oldstr = rl_line_buffer ;
185
185
if (value ) {
186
- /* XXX if (rl_line_buffer) free(rl_line_buffer); */
187
186
if (!try_convert_to_string (value )) {
188
187
RETURN_THROWS ();
189
188
}
190
- rl_line_buffer = strdup (Z_STRVAL_P (value ));
189
+ #ifndef PHP_WIN32
190
+ if (strlen (oldstr ) < Z_STRLEN_P (value )) {
191
+ rl_extend_line_buffer (Z_STRLEN_P (value ) + 1 );
192
+ }
193
+ memcpy (rl_line_buffer , Z_STRVAL_P (value ), Z_STRLEN_P (value ) + 1 );
194
+ rl_end = Z_STRLEN_P (value );
195
+ #else
196
+ char * tmp = strdup (Z_STRVAL_P (value ));
197
+ if (tmp ) {
198
+ if (rl_line_buffer ) {
199
+ free (rl_line_buffer );
200
+ }
201
+ rl_line_buffer = tmp ;
202
+ }
203
+ #endif
191
204
}
192
205
RETVAL_STRING (SAFE_STRING (oldstr ));
193
206
} else if (zend_string_equals_literal_ci (what , "point" )) {
You can’t perform that action at this time.
0 commit comments