Re: Fixing string offsets of strings.
| From: | Alan Knowles | Date: | Wed, 21 Dec 2011 14:23:32 +0000 |
| Subject: | Re: Fixing string offsets of strings. | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56978@lists.php.net to get a copy of this message | ||
The fix for the warning is to use 0, rather than -1 as the last argument for is_numeric_string(), only in the zend_vm - isset code - it's a usefull warning when not used with isset.
I'm just testing a patch and the related tests and will upload it to the bug soon.
Regards
Alan
On Monday, December 19, 2011 09:19 AM, Stas Malyshev wrote:
Hi!This should implement the isset() return false, and accessing producing a warning (but 'less' BC by returning the first character) https://bugs.php.net/patch-display.php?bug_id=60362&patch=isset_changed_warning_only_on_access.patch&revision=latest <https://bugs.php.net/patch-display.php?bug_id=60362&patch=isset_changed_warning_only_on_access.patch&revision=latest> I did end up changing most of the error messages in the affected tests to "%s on line %d".... is that the prefered way of doing it?One note about this: conversion behavior is non-obvious there, e.g.: 'foo' - gets converted to 0 and produces: Illegal string offset 'foo' '12.34' - gets converted to 12 and produces: Illegal string offset '12.34' but '56 and foo' - gets converted to 56 and produces: A non well formed numeric value encountered I guess it's ok but error messages are different.