note 91591 added to function.shm-get-var
| From: | benjamin at josefus dot net | Date: | Thu, 18 Jun 2009 12:53:29 +0000 |
| Subject: | note 91591 added to function.shm-get-var | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-157055@lists.php.net to get a copy of this message | ||
Don't just suppress Warnings! Solve Problems!
The Reference says:
"mixed shm_get_var ( resource $shm_identifier , int $variable_key ) "
So don't let neither an array nor a string or something else to be the 2nd Parameter! An
Integer (a possibly quite long one) is expected!
WRONG
This causes a Warning "shm_put_var() expects parameter 2 to be long, string given" and
shm_put_var() failed with returning FALSE.
<?php
// ...
$a = "any kind of data";
shm_put_var($shm_id, $a, $a);
?>
RIGHT
Use a (long) Integer to be Key for Shared Variable
<?php
// ...
$a = "any kind of data";
shm_put_var($shm_id, 12345, $a);
?>
----
Server IP: 209.41.74.194
Probable Submitter: 84.58.9.91
----
Manual Page -- http://www.php.net/manual/en/function.shm-get-var.php
Edit -- https://master.php.net/note/edit/91591
Del: integrated -- https://master.php.net/note/delete/91591/integrated
Del: useless -- https://master.php.net/note/delete/91591/useless
Del: bad code -- https://master.php.net/note/delete/91591/bad+code
Del: spam -- https://master.php.net/note/delete/91591/spam
Del: non-english -- https://master.php.net/note/delete/91591/non-english
Del: in docs -- https://master.php.net/note/delete/91591/in+docs
Del: other reasons-- https://master.php.net/note/delete/91591
Reject -- https://master.php.net/note/reject/91591
Search -- https://master.php.net/manage/user-notes.php