ID:               47903
 Updated by:       j...@php.net
 Reported By:      cFreed at orange dot fr
-Status:           Verified
+Status:           Assigned
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      5.2.9
-Assigned To:      
+Assigned To:      felipe
 New Comment:

Felipe, this same (?) issue was reported in bug #39018 and was supposed
to be closed too..was the fix omitted from PHP_5_2 branch?



Previous Comments:
------------------------------------------------------------------------

[2009-04-06 08:34:36] ka...@php.net

Verified in the PHP_5_2 branch only, PHP_5_3 and HEAD does not produce
this, reclassified

------------------------------------------------------------------------

[2009-04-05 19:05:35] cFreed at orange dot fr

Description:
------------
A case where the error-control operator @ does NOT work, despite of
what the manual says.

Reproduce code:
---------------
---
>From manual page: language.operators.errorcontrol
---
The manual says:
"A simple rule of thumb is: if you can take the value of something, you
can prepend the @ operator to it."

This is not always true.

As shown by the example given, this works, assuming $cache IS AN
ARRAY:
<?php
$value = @$cache[$key]; 
// will not issue a notice if the index $key doesn't exist.
?>

But it does not work if $cache IS A STRING, and $key is an integer
higher than strlen($cache)-1. in other words:
<?php
$str='abc';
$val...@$str[5];
// will issue the notice "Uninitialized string offset 5 in...".
?>



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47903&edit=1

Reply via email to