#46148 [NEW]: ((strlen($someString) <= $someInteger) ? someStatement : someStatement) fails
From: Yuji1 at mail dot com
Operating system: Windows XP Pro SP2
PHP version: 5.2.6
PHP Bug Type: Scripting Engine problem
Bug description: ((strlen($someString) <= $someInteger) ? someStatement : someStatement) fails
Description:
------------
(somefunction($someObject) someOperator $someObject) ? someStatement :
someStatement
and
((somefunction($someObject) someOperator $someObject) ? someStatement :
someStatement)
fail
but
((somefunction($someObject someOperator $someObject) ? someStatement :
someStatement)
works. :/
Reproduce code:
---------------
$queryResults was an array of strings, [1] being a string. It had length,
yes.
I used:
$queryResults[1] = (strlen($queryResults[1]) <= 300) ?
substr($queryResults[1], 0, 300) : $queryResults[1]);
It however fails.
This fails too:
$queryResults[1] = strlen($queryResults[1]) <= 300 ?
substr($queryResults[1], 0, 300) : $queryResults[1];
This works:
$queryResults[1] = (strlen($queryResults[1] <= 300) ?
substr($queryResults[1], 0, 300) : $queryResults[1]);
Expected result:
----------------
I expected it to well, shorten the length to 300.
Actual result:
--------------
Completely fails. In fact, without the (strlen($queryResults[1] <= 300)
being that way, it does this (example is of a database query, and PER ROW
IT PRINTS OUT THE FOLLOWING STRING, THE POST STRING FOR NEWS):
First post:
StringStringStringString
Second post:
StringStringStringStringStringStringString
Third post:
StringStringStringStringStringStringStringStringStringString
Etc.
--
Edit bug report at http://bugs.php.net/?id=46148&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46148&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46148&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46148&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46148&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=46148&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46148&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46148&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46148&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46148&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46148&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46148&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46148&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46148&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46148&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46148&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46148&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46148&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46148&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46148&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46148&r=mysqlcfg
Thread (6 messages)
- Yuji1 at mail dot com