Re: [PATCH] create_function/zend_eval_string aren't binary-safe
| From: | Andrei Zmievski | Date: | Wed, 03 Jun 2009 20:16:33 +0000 |
| Subject: | Re: [PATCH] create_function/zend_eval_string aren't binary-safe | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44135@lists.php.net to get a copy of this message | ||
Matt Wilmas wrote:
Hi all, I first noticed this with preg_replace()'s /e modifier (SO many other issues with that...), but it also happens with create_function() and a few other places where zend_eval_string() is used. Other code evaluation in PHP is binary-safe, so it seems like these areas should be as well? In case an example is needed: $func = create_function('', "return strlen('Test\0string');"); echo $func(); Patches: http://realplain.com/php/binary_eval_string.diff http://realplain.com/php/binary_eval_string_5_3.diff Can they be applied? (Also a small optimization by eliminating strlen() usage.) May want to verify the ext/interbase change.Yes, apply them (though I didn't verify the interbase patch).
I noticed there are several zend_eval_string() references in PECL sources [1], which would be a problem after adding a string length parameter... How is that handled? Should the updated function be eval_stringL instead and add macros for compatibility?I'd prefer that. -Andrei