File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ PHP NEWS
5050 . Fixed bug GH-15094 (php_random_default_engine() is not C++ conforming).
5151 (cmb)
5252
53+ - Readline:
54+ . Fixed readline_info, rl_line_buffer_length/rl_len globals on update.
55+ (David Carlier)
56+
5357- Standard:
5458 . Fix references in request_parse_body() options array. (nielsdos)
5559 . Add RoundingMode enum. (timwolla, saki)
Original file line number Diff line number Diff line change @@ -183,11 +183,24 @@ PHP_FUNCTION(readline_info)
183183 if (zend_string_equals_literal_ci (what ,"line_buffer" )) {
184184 oldstr = rl_line_buffer ;
185185 if (value ) {
186- /* XXX if (rl_line_buffer) free(rl_line_buffer); */
187186 if (!try_convert_to_string (value )) {
188187 RETURN_THROWS ();
189188 }
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
191204 }
192205 RETVAL_STRING (SAFE_STRING (oldstr ));
193206 } else if (zend_string_equals_literal_ci (what , "point" )) {
You can’t perform that action at this time.
0 commit comments