Re: shmop errors

From: Date: Wed, 16 Jan 2002 20:19:34 +0000
Subject: Re: shmop errors
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-77301@lists.php.net to get a copy of this message
I've tested your code on 4.1.1 release with the recent SHMOP patch that is 
already part of the latest CVS. The code worked fine and did not generate any 
warning or errors.

I did however commented out the sem_* functions.

Ilia

P.S. Try using the latest CVS

On January 16, 2002 01:17 pm, Robin Ericsson wrote:
> I was playing with shmop ext today, and found out it was full of errors :)
>
> This is my code:
> Writing:
>     define("SHMKEY", 0xDEAD);
>     define("SEMKEY", 0xCAFE);
>
>     $shm_id = @shmop_open(SHMKEY, "a", 0644, 10);
>     if (!$shm_id)
>     {
>      $sem_id = sem_get(SEMKEY, 1, 0666);
>      $shm_id = shmop_open(SHMKEY, "c", 0644, 10);
>      sem_acquire($sem_id);
>      shmop_write($shm_id, "0", 0);
>      sem_release($sem_id);
>     }
>
> Reading:
>   $shm_id = @shmop_open(SHMKEY, "a", 0644, 10);
>
>   if (!$shm_id)
>   {
>    return "0";
>   }
>   else
>   {
>    $count = shmop_read($shm_id, 0, shmop_size($shm_id));
>    shmop_close($shm_id);
>    return $count;
>   }
>
> Which give me the following error:
> Warning: String is not zero-terminated (0) (source: zend_execute_API.c:274)
>
>
> I'm using 4.1.1, btw.
>
>
> -- robin


Thread (7 messages)

« previous php.dev (#77301) next »