We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a7f0fe1 commit 4335e31Copy full SHA for 4335e31
ext/readline/readline.c
@@ -183,11 +183,18 @@ PHP_FUNCTION(readline_info)
183
if (zend_string_equals_literal_ci(what,"line_buffer")) {
184
oldstr = rl_line_buffer;
185
if (value) {
186
- /* XXX if (rl_line_buffer) free(rl_line_buffer); */
187
if (!try_convert_to_string(value)) {
188
RETURN_THROWS();
189
}
+#ifndef PHP_WIN32
190
+ if (strlen(oldstr) < Z_STRLEN_P(value)) {
191
+ rl_extend_line_buffer(Z_STRLEN_P(value) + 1);
192
+ }
193
+ strcpy(rl_line_buffer, Z_STRVAL_P(value));
194
+ rl_end = Z_STRLEN_P(value);
195
+#else
196
rl_line_buffer = strdup(Z_STRVAL_P(value));
197
+#endif
198
199
RETVAL_STRING(SAFE_STRING(oldstr));
200
} else if (zend_string_equals_literal_ci(what, "point")) {
0 commit comments