|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 17 Nov 2005 22:51:22 -0000 Issue 3800
php-general-digest-help
lists.php.net
Date: Thu Nov 17 2005 - 16:51:22 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 17 Nov 2005 22:51:22 -0000 Issue 3800
Topics (messages 225962 through 226015):
Re: Shared Memory Problem
225962 by: Jochem Maas
plese help
225963 by: Aftab Alam
225972 by: Angelo Zanetti
225974 by: James Benson
Re: SOAP and PHP
225964 by: Angelo Zanetti
225965 by: James Benson
Re: Server Client Architecture, best parctice
225966 by: James Benson
225969 by: James Benson
225971 by: Mariano Guadagnini
Re: unsubscribing
225967 by: James Benson
Wierd error
225968 by: Chris Boget
225970 by: Chris Boget
225973 by: James Benson
225978 by: Chris Boget
225982 by: Jochem Maas
225985 by: Chris Boget
225989 by: Jochem Maas
225991 by: Ford, Mike
225995 by: Chris Boget
225996 by: Chris Boget
Suppressing Notices from imap_headerinfo()?
225975 by: Mike Walsh
Re: How to build a XML DTD on "the fly"?
225976 by: James Benson
OS Detection
225977 by: Rahul S. Johari
225988 by: Rahul S. Johari
225998 by: Lowell Allen
Re: better way to mix html and php code?
225979 by: James Benson
226001 by: Dan Baker
226005 by: Robert Cummings
226008 by: Dan Baker
Cookies
225980 by: Ben Miller
225981 by: Dan McCullough
225983 by: Richard Davey
225984 by: Robert Cummings
225986 by: Richard Davey
225990 by: Dan McCullough
225992 by: Richard Davey
225993 by: Dan McCullough
225994 by: Ben Miller
225997 by: Richard Davey
Re: Sending arrays from page to page
225987 by: Lowell Allen
Re: Formatting of a number
225999 by: Dan Baker
checkng if string is a number
226000 by: blackwater dev
226002 by: Ben
226003 by: Curt Zirzow
226004 by: Max Belushkin
226006 by: Max Belushkin
226013 by: Max Belushkin
Re: PHP 4.4.1 on Apache 2.0.x issue
226007 by: Max Belushkin
php related segmentation fault with Apache 2.0.55
226009 by: kristina clair
226011 by: Max Belushkin
226014 by: kristina clair
Does anyone here use the pecl extension APC?
226010 by: Jochem Maas
php + cURL issue
226012 by: Nate Nielsen
226015 by: Nate Nielsen
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
Yaswanth Narvaneni wrote:
> Hi!
>
> I found the solution to my prob. SELinux was enabled in the server
> which needs disabling. After disabling SELinux it was working great.
> Thanks for your help guys.
>
> Another small query though, is there anyway to enable SELinux and as
> well use shared memory between PHP and C++? I know using Zend engine
the zend engine is free.. I think you mean 'Zend <Some Product Name>' instead :-)
> would solve the prob, but we need to buy zend which is very costly for
> me, any other solution is welcome.
I have no idea if it either possible or efficient enough for your
needs but you may be able to use pipes?
http://php.net/proc_open
>
> Regards,
> Yaswanth
>
> On 11/16/05, Curt Zirzow <czirzow
gmail.com> wrote:
>
>>On Wed, Nov 16, 2005 at 03:33:22AM +0530, Yaswanth Narvaneni wrote:
>>
>>>Hi!
>>>
>>>I have a server written in C++ and my webpages are in PHP. The PHP has
>>>to communicate with the server using shared memory. This was working
>>>fine on the server running FC-1 with php-4.3.8. We recently migrated
>>>to CentOS 4.1 (Equivalent to RHEL 4.1) running php-4.3.9. The error it
>>>displays is as follows:
>>>
>>>shmop_open(): unable to attach or create shared memory segment in
>>>/var/www/html/sharedmem.php on line 2
>>>
>>>The server opens the shm in 666 (originally was 644) even then it was
>>>not working. I can see the shared mem open using 'ipcs' command.
>>>
>>>...
>>>$shm_id = shmop_open($shm_key, "a",0,0) or die("FATAL ERROR:: Unable
>>>to Access Shared Memory");
>>
>>You might want to try to open it within the same mode that the
>>server created it in:
>>
>>1)
>> $shm_id = shmop_open($shm_key, "a",0666,0);
>>
>>2)
>> are you 100% sure the key is valid? the error message you are
>> getting seems to point in this direction since the shmop_open is
>> failing on the C call to shmget(), wich usually fails when either
>> you dont have enough memory to create it (which you arn't doing),
>> some other creation problems, or that the key supplied wasn't
>> found.
>>
>>
>>Curt.
>>--
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>
> --
> "In theory there is no difference between theory and practice.
> In practice there is." -- Fortune Cookie
>
attached mail follows:
Hello,
I want to create a trigger in PostgresSQL ,
In trigger, Before inserting the record i want to check that data is
available or not, if data is not there then the insert script execute
otherwise trigget check the next insert script.
Please reply.
Regards,
_____
Aftab Alam
-----Original Message-----
From: php-general-digest-help
lists.php.net
[mailto:php-general-digest-help
lists.php.net]
Sent: Monday, October 17, 2005 4:06 PM
To: php-general
lists.php.net
Subject: php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
Topics (messages 224207 through 224218):
Funky array question
224207 by: Brian Dunning
224209 by: Minuk Choi
224210 by: Jordan Miller
224211 by: Jordan Miller
224212 by: Jordan Miller
Re: editor
224208 by: yangshiqi1089
a couple of problems with PHP form
224213 by: Bruce Gilbert
224218 by: Mark Rees
Re: OPTIMIZING - The fastest way to open and show a file
224214 by: Ruben Rubio Rey
224215 by: Ruben Rubio Rey
224216 by: ac
can't get IIS to run php if the script is not directly under wwwroot
224217 by: tony yau
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
yes Im sure everyone is going to answer seeing that this is a postgres
list... oh wait its a PHP list.
Sorry buddy, think you're goin to get flamed.
Aftab Alam wrote:
> Hello,
>
> I want to create a trigger in PostgresSQL ,
>
> In trigger, Before inserting the record i want to check that data is
> available or not, if data is not there then the insert script execute
> otherwise trigget check the next insert script.
>
> Please reply.
>
>
>
>
> Regards,
> _____
>
> Aftab Alam
>
>
>
>
> -----Original Message-----
> From: php-general-digest-help
lists.php.net
> [mailto:php-general-digest-help
lists.php.net]
> Sent: Monday, October 17, 2005 4:06 PM
> To: php-general
lists.php.net
> Subject: php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
>
>
>
> php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
>
> Topics (messages 224207 through 224218):
>
> Funky array question
> 224207 by: Brian Dunning
> 224209 by: Minuk Choi
> 224210 by: Jordan Miller
> 224211 by: Jordan Miller
> 224212 by: Jordan Miller
>
> Re: editor
> 224208 by: yangshiqi1089
>
> a couple of problems with PHP form
> 224213 by: Bruce Gilbert
> 224218 by: Mark Rees
>
> Re: OPTIMIZING - The fastest way to open and show a file
> 224214 by: Ruben Rubio Rey
> 224215 by: Ruben Rubio Rey
> 224216 by: ac
>
> can't get IIS to run php if the script is not directly under wwwroot
> 224217 by: tony yau
>
> Administrivia:
>
> To subscribe to the digest, e-mail:
> php-general-digest-subscribe
lists.php.net
>
> To unsubscribe from the digest, e-mail:
> php-general-digest-unsubscribe
lists.php.net
>
> To post to the list, e-mail:
> php-general
lists.php.net
>
>
> ----------------------------------------------------------------------
>
attached mail follows:
Aftab Alam wrote:
> Hello,
>
> I want to create a trigger in PostgresSQL ,
>
> In trigger, Before inserting the record i want to check that data is
> available or not, if data is not there then the insert script execute
> otherwise trigget check the next insert script.
>
> Please reply.
>
>
What, and you expect someone to code this for you?
What was your question?
>
>
> Regards,
> _____
>
> Aftab Alam
>
>
>
>
> -----Original Message-----
> From: php-general-digest-help
lists.php.net
> [mailto:php-general-digest-help
lists.php.net]
> Sent: Monday, October 17, 2005 4:06 PM
> To: php-general
lists.php.net
> Subject: php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
>
>
>
> php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
>
> Topics (messages 224207 through 224218):
>
> Funky array question
> 224207 by: Brian Dunning
> 224209 by: Minuk Choi
> 224210 by: Jordan Miller
> 224211 by: Jordan Miller
> 224212 by: Jordan Miller
>
> Re: editor
> 224208 by: yangshiqi1089
>
> a couple of problems with PHP form
> 224213 by: Bruce Gilbert
> 224218 by: Mark Rees
>
> Re: OPTIMIZING - The fastest way to open and show a file
> 224214 by: Ruben Rubio Rey
> 224215 by: Ruben Rubio Rey
> 224216 by: ac
>
> can't get IIS to run php if the script is not directly under wwwroot
> 224217 by: tony yau
>
> Administrivia:
>
> To subscribe to the digest, e-mail:
> php-general-digest-subscribe
lists.php.net
>
> To unsubscribe from the digest, e-mail:
> php-general-digest-unsubscribe
lists.php.net
>
> To post to the list, e-mail:
> php-general
lists.php.net
>
>
> ----------------------------------------------------------------------
attached mail follows:
Angelo Zanetti wrote:
> Hi guys.
>
> I've googled but found so many pages that I'm not sure what to use.
>
> I want to use PHP to make use of SOAP.
>
> I've found:
> -nuSoap
> -libxml(2)
> -php-soap
> -and others which seemed less important.
>
> Can you recommend which one to use? and which one is the most supported.
> Also if I've missed some that you feel I should know about please let me
> know.
> Thanks in advance.
>
> Angelo
>
HI guys.
I've found nuSOAP. it seems to work well. Im not using PHP5 so couldnt
use the suggestions but thanks anyway...
http://dietrich.ganx4.com/nusoap/
regards
attached mail follows:
Petr Smith wrote:
> Torgny Bjers wrote:
>
>> Angelo Zanetti wrote:
>>
>>
>>> Hi guys.
>>>
>>> I've googled but found so many pages that I'm not sure what to use.
>>>
>>> I want to use PHP to make use of SOAP.
>>>
>>> I've found:
>>> -nuSoap
>>> -libxml(2)
>>> -php-soap
>>> -and others which seemed less important.
>>>
>>> Can you recommend which one to use? and which one is the most supported.
>>> Also if I've missed some that you feel I should know about please let
>>> me know.
>>> Thanks in advance.
>>>
>>> Angelo
>>
>>
>>
>>
>> Not sure, but there's already a couple of relevant classes in PEAR:
>> http://pear.php.net/search.php?q=soap&in=packages&x=0&y=0
>>
>> A hot tip is to always search in the packages there. :)
>> http://pear.php.net/packages.php
>>
>> Warm Regards,
>> Torgny
>>
>
> Who uses PEAR? Mess of old unsupported and undocumented libraries which
> only their authors (maybe) can use?
>
LOL, what does your code look like huh?
I use pear when documentation is available or API docs are easily
understood.
DB, Mime_Mail, HTTP_REQUEST are a few Ive used and still do, your
obviously not experienced enough to read and reuse others code
> I would recommend PHP5 SOAP extension, based on libxml2. It works
> without problems and without messing with PEAR.
>
> You can start with this tutorial:
> http://www-128.ibm.com/developerworks/library/os-phpws/?ca=dgr-lnxw06PHP5soap
>
>
> Petr
attached mail follows:
Are both servers on the same machine?
Yaswanth Narvaneni wrote:
> Hi!
>
> I would like to know what does the community think of the best
> architecture for server client communication and why? That is, if
> there is a server in C++ (say a game server) and the PHP has to 'read'
> data 'from' the server then what is the best form of communication?
>
> a) Shared Memory : Server opens the shared memory in write and the PHP
> scripts open it in read and gets the data
> b) TMPFS (just like shared memory): Server opens a file in tmpfs in
> write and PHP in read
> c) Databases: Server Updates a table in the DB and client reads from the table
> d) Files: Same as TMPFS
>
> Regards,
> Yaswanth
>
> --
> "In theory there is no difference between theory and practice.
> In practice there is." -- Fortune Cookie
attached mail follows:
Each has its own benefits, if on a shared server then a database would
be the most secure I think, if its a dedicated server then tmpfs or just
plain old files will probably be the best, it also depends on various
other factors like, server hardware and bandwith, only you can select
the best option for your particular setup.
James
Yaswanth Narvaneni wrote:
> Hi!
>
> I would like to know what does the community think of the best
> architecture for server client communication and why? That is, if
> there is a server in C++ (say a game server) and the PHP has to 'read'
> data 'from' the server then what is the best form of communication?
>
> a) Shared Memory : Server opens the shared memory in write and the PHP
> scripts open it in read and gets the data
> b) TMPFS (just like shared memory): Server opens a file in tmpfs in
> write and PHP in read
> c) Databases: Server Updates a table in the DB and client reads from the table
> d) Files: Same as TMPFS
>
> Regards,
> Yaswanth
>
> --
> "In theory there is no difference between theory and practice.
> In practice there is." -- Fortune Cookie
attached mail follows:
Reading this, a question arose me: is it possible to read a shared
memory area with php, supposing than both programs are in the same
machine? does php support ipc? that would be greatly useful.
Mariano.
James Benson wrote:
> Each has its own benefits, if on a shared server then a database would
> be the most secure I think, if its a dedicated server then tmpfs or
> just plain old files will probably be the best, it also depends on
> various other factors like, server hardware and bandwith, only you can
> select the best option for your particular setup.
>
>
> James
>
>
>
>
>
> Yaswanth Narvaneni wrote:
>
>> Hi!
>>
>> I would like to know what does the community think of the best
>> architecture for server client communication and why? That is, if
>> there is a server in C++ (say a game server) and the PHP has to 'read'
>> data 'from' the server then what is the best form of communication?
>>
>> a) Shared Memory : Server opens the shared memory in write and the PHP
>> scripts open it in read and gets the data
>> b) TMPFS (just like shared memory): Server opens a file in tmpfs in
>> write and PHP in read
>> c) Databases: Server Updates a table in the DB and client reads from
>> the table
>> d) Files: Same as TMPFS
>>
>> Regards,
>> Yaswanth
>>
>> --
>> "In theory there is no difference between theory and practice.
>> In practice there is." -- Fortune Cookie
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.3/173 - Release Date: 16/11/2005
attached mail follows:
Read the instructions on php.net, their are two different ways to
unsuscribe, either email or use the web interface,
http://php.net/mailing-lists.php
wayne wrote:
> I tried to unsubscribe on several occasion without
> success. I followed the instruction at the bottom
> of the email. Can someone take me off the list.
> Thank You.
attached mail follows:
I'm seeing the following line showing up in my logs:
08:08:30 [warning] [Unknown][0]: Unknown(): Unable to call () - function
does not exist
and I've narrowed it down to this line of code:
settype( &$dbObject, "null" );
When I comment out the above line, the error goes away. When
I uncomment it out, the error comes back. I've used both single
and double quotes, I've tried using different types, I've tried passing
the object both by value and by reference but nothing seems to help.
What's going on?
thnx,
Chris
attached mail follows:
> I'm seeing the following line showing up in my logs:
>
> 08:08:30 [warning] [Unknown][0]: Unknown(): Unable to call () - function
> does not exist
>
> and I've narrowed it down to this line of code:
Update, it turns out it's not the settype(). Here's a larger context of the
offending
area of code:
$query = '<my query>';
$queryResult =& $DBAccess->db->query( $query );
if( !( DB::isError( $queryResult ))) {
$tmpArray = array();
while( $queryResult->fetchInto( $tmpArray )) {
$dbObject = new IPI_OfficeDetailsInterface();
$dbObject->_populateMemberVariables( $tmpArray );
$retval[] = $dbObject;
$tmpArray = array();
settype( $dbObject, "null" );
}
}
The line to concentrate on is this one:
$dbObject = new IPI_OfficeDetailsInterface();
If I leave it as above, no error occurs. But I instead instantiate
$dbObject
as follows (which is what I was doing originally)
$dbObject &= new IPI_OfficeDetailsInterface();
then the error shows up in the log again. The error only goes away if I
either
remove the settype() function call or I remove the '&' in the instantiation.
Why?
thnx,
Chris
attached mail follows:
There is nothing weird when this function takes a variable as the
argument and your using an object, read the manual
http://php.net/settype
You could try:-
$dbObject = (null) $dbObject;
Ive not tested that but think it should work!
James
Chris Boget wrote:
> I'm seeing the following line showing up in my logs:
>
> 08:08:30 [warning] [Unknown][0]: Unknown(): Unable to call () -
> function does not exist
>
> and I've narrowed it down to this line of code:
>
> settype( &$dbObject, "null" );
>
> When I comment out the above line, the error goes away. When
> I uncomment it out, the error comes back. I've used both single
> and double quotes, I've tried using different types, I've tried passing
> the object both by value and by reference but nothing seems to help.
>
> What's going on?
>
> thnx,
> Chris
attached mail follows:
> There is nothing weird when this function takes a variable as the
> argument and your using an object, read the manual
> http://php.net/settype
I'm not sure what you mean here. Nowhere on the doc page for
settype() (at least, not that I saw) does it say you can't pass an
object as the first argument. Or, if you do, there is odd results.
Additionally, we are using settype() to null out/unset objects else
where in our code and that causes no error to show up in the log.
thnx,
Chris
attached mail follows:
Chris Boget wrote:
>> I'm seeing the following line showing up in my logs:
>>
>> 08:08:30 [warning] [Unknown][0]: Unknown(): Unable to call () -
>> function does not exist
>>
>> and I've narrowed it down to this line of code:
>
>
> Update, it turns out it's not the settype(). Here's a larger context of
> the offending
> area of code:
>
> $query = '<my query>';
>
> $queryResult =& $DBAccess->db->query( $query );
>
> if( !( DB::isError( $queryResult ))) {
> $tmpArray = array();
> while( $queryResult->fetchInto( $tmpArray )) {
> $dbObject = new IPI_OfficeDetailsInterface();
> $dbObject->_populateMemberVariables( $tmpArray );
> $retval[] = $dbObject;
>
> $tmpArray = array();
> settype( $dbObject, "null" );
why not just do:
unset($dbObject);
?
>
> }
> }
>
> The line to concentrate on is this one:
>
> $dbObject = new IPI_OfficeDetailsInterface();
>
> If I leave it as above, no error occurs. But I instead instantiate
> $dbObject
> as follows (which is what I was doing originally)
>
> $dbObject &= new IPI_OfficeDetailsInterface();
so you want to do a bitwise AND on a non-existant variable and a newly creately object??
maybe you meant to do:
$dbObject =& new IPI_OfficeDetailsInterface();
>
> then the error shows up in the log again. The error only goes away if I
> either
> remove the settype() function call or I remove the '&' in the
> instantiation.
>
> Why?
>
> thnx,
> Chris
attached mail follows:
> why not just do:
> unset($dbObject);
We were using unset() for the longest time but found it doesn't
seem to free up the memory.
>> $dbObject &= new IPI_OfficeDetailsInterface();
> so you want to do a bitwise AND on a non-existant variable and a newly
> creately object??
> maybe you meant to do:
> $dbObject =& new IPI_OfficeDetailsInterface();
You are right. My original email contained a typo. It should have
been '=&' as that is what is in our code.
thnx,
Chris
attached mail follows:
Chris Boget wrote:
>> why not just do:
>> unset($dbObject);
>
>
> We were using unset() for the longest time but found it doesn't
> seem to free up the memory.
interesting - you are suggesting that settype does free the memory
directly? I have seen a number of posts to internals regarding to
being able to free up memory in long-running/heavy cli scripts...
none of the devs mentioned settype() ... maybe you know something
nobody else does :-)
>
>>> $dbObject &= new IPI_OfficeDetailsInterface();
>>
>> so you want to do a bitwise AND on a non-existant variable and a newly
>> creately object??
>> maybe you meant to do:
>> $dbObject =& new IPI_OfficeDetailsInterface();
>
>
> You are right. My original email contained a typo. It should have
> been '=&' as that is what is in our code.
darn, no easy fix then.
why didn't you paste the code verbatim? - typing it over by hand
(or approximating) is a waste of (other) peoples time. (i.e. they are
trying to help you fix code that doesn't really exist)
>
> thnx,
> Chris
>
attached mail follows:
On 17 November 2005 14:31, Chris Boget wrote:
> > I'm seeing the following line showing up in my logs:
> >
> > 08:08:30 [warning] [Unknown][0]: Unknown(): Unable to call () -
> > function does not exist
> >
>
> The line to concentrate on is this one:
>
> $dbObject = new IPI_OfficeDetailsInterface();
>
> If I leave it as above, no error occurs. But I instead instantiate
> $dbObject as follows (which is what I was doing originally)
>
> $dbObject &= new IPI_OfficeDetailsInterface();
Should be =& -- &= is trying to do a bitwise and operation, which isn't terribly meaningful when an object is involved!
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford
leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm
attached mail follows:
>> We were using unset() for the longest time but found it doesn't
>> seem to free up the memory.
> interesting - you are suggesting that settype does free the memory
> directly?
Yes. Moreso than unset(), at least according to my observations and
tests.
> I have seen a number of posts to internals regarding to being able to
> free up memory in long-running/heavy cli scripts... none of the devs
> mentioned settype() ... maybe you know something nobody else does :-)
We have a very process intensive script that creates (and destroys) a
large number of objects. As this script gets run again and again, we
would see that the memory load would go through the roof and eventually
cause Apache to crash (among other things; btw - this is running on
a windoze box). We changed all the unset() to settype() and the
memory usage over the same amount of time dropped dramatically -
significantly, in fact.
thnx,
Chris
attached mail follows:
> There is nothing weird when this function takes a variable as the
> argument and your using an object, read the manual
Are you suggesting that settype() can't be used for objects? The
documentation doesn't seem to indicate that...
> You could try:-
> $dbObject = (null) $dbObject;
> Ive not tested that but think it should work!
Nope.
Parse error: parse error, unexpected T_VARIABLE in
thnx,
Chris
attached mail follows:
I am using imap_headerinfo() to query articles from an NNTP server.
I have encountered a situation where I can't suppress some notices from
imap_headerinfo() and I can't figure out why. It appears that
imap_headerinfo() doesn't like the e-mail address in the article (which is
SPAM blocked) and spits out the following:
Notice: (null)(): Unterminated mailbox: t.gould
.MISSING-HOST-NAME.
(errflg=3) in Unknown on line 0
Notice: (null)(): Must use comma to separate addresses:
lancaster(DOT.)ac(DOT.)uk> (errflg=3) in Unknown on line 0
I have tried calling ob_start() and ob_clean() around my calls to
imap_headerinfo() as well as adding the '
' character to the call to
imap_headerinfo().
ob_start() ;
$header =
imap_headerinfo($nntp, $i) ;
$ob = ob_get_contents() ;
ob_clean() ;
Oddly the $ob variable doesn't contain anything which implies that
imap_headerinfo() is dumping it's notices directly.
Any suggestions on how to suppress these notices? I don't even use the
email field in my application.
Thanks,
Mike
--
Mike Walsh -- mike underscore walsh at mindspring dot com
attached mail follows:
Learn DTD and how it works first then you will know :-)
A DTD is contained in an external file and not in XML, so you would
create a DTD file then link it from the XML like so,
<!DOCTYPE document SYSTEM "document.dtd">
Erik Franzén wrote:
> The code below lacks the part where the folling DTD attribute is
> created: <!ATTLIST document id ID #IMPLIED>
>
> How can I create the above DTD attribute in the code below?
>
> <?php
> // Creates an instance of the DOMImplementation class
> $oDomImp = new DOMImplementation;
>
> // Creates a DOMDocumentType instance
> $oDomDtd = $oDomImp->createDocumentType('document', null, null);
>
> // Creates a DOMDocument instance
> $oDom = $oDomImp->createDocument("", "", $oDomDtd);
>
> // Set other properties
> $oDom->encoding = 'iso-8859-1';
> $oDom->standalone = true;
>
> // Create an empty element
> $oElement = $oDom->createElement('document', 'test');
> $oElement->setAttribute('id', '123');
> // Append the element
> $oDom->appendChild($oElement);
>
> // Retrieve and print the document
> echo $oDom->saveXML() . "\n";
>
> echo "TagName: " . $oDom->getElementById('123')->tagName;
> ?>
>
> Now the code produces the following result:
>
> <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>
> <!DOCTYPE document>
> <document id="123">test</document>
>
> TagName:
>
>
> Thanks
> /Erik
attached mail follows:
Ave,
I'm working on a Guestbook for a site and I'm trying to identify Browser &
Operating System of the user and eventually I'll display the Icon matching
the Browser/OS in the entry.
I'm able to identify and use an If Conditional statement for the Browser,
but I can't seem to identify the OS.
This is what I'm using to identify the Browser:
function browser_detection( $which_test ) {
// initialize the variables
$browser = '';
$dom_browser = '';
// set to lower case to avoid errors, check to see if http_user_agent is set
$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ?
strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
// run through the main browser possibilities, assign them to the main
$browser variable
if (stristr($navigator_user_agent, "opera"))
{
$browser = 'opera';
$dom_browser = true;
}
elseif (stristr($navigator_user_agent, "msie 4"))
{
$browser = 'msie4';
$dom_browser = false;
}
elseif (stristr($navigator_user_agent, "msie"))
{
$browser = 'msie';
$dom_browser = true;
}
elseif ((stristr($navigator_user_agent, "konqueror")) ||
(stristr($navigator_user_agent, "safari")))
{
$browser = 'safari';
$dom_browser = true;
}
elseif (stristr($navigator_user_agent, "gecko"))
{
$browser = 'mozilla';
$dom_browser = true;
}
elseif (stristr($navigator_user_agent, "mozilla/4"))
{
$browser = 'ns4';
$dom_browser = false;
}
else
{
$dom_browser = false;
$browser = false;
}
// return the test result you want
if ( $which_test == 'browser' )
{
return $browser;
}
elseif ( $which_test == 'dom' )
{
return $dom_browser;
// note: $dom_browser is a boolean value, true/false, so you can just test
if
// it's true or not.
}
}
$user_browser = browser_detection('browser');
echo "$user_browser";
if ( $user_browser == 'opera' )
{
echo "OPERA";
}
else {
echo "SOMETHING ELSE";
}
?>
Any suggestions on getting the OS ?
Thanks,
Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180
Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: rahul
informed-sources.com
http://www.informed-sources.com
attached mail follows:
Ave,
Interesting.
I did get this JavaScript code for OS detection:
// This script sets OSName variable as follows:
// "Windows" for all versions of Windows
// "MacOS" for all versions of Macintosh OS
// "Linux" for all versions of Linux
// "UNIX" for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS
var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
document.write('Your OS: '+OSName);
Which does serve my purpose. I guess I'll work something with this out.
Thanks.
On 11/17/05 10:21 AM, "George Pitcher" <george.pitcher
ingenta.com> wrote:
> Rahul,
>
> The Client OS is a 'client' object, so isn't necessarily passed by the
> Browser. Try javascript.
>
> George
>
>> -----Original Message-----
>> From: Rahul S. Johari [mailto:rjohari
nycap.rr.com]
>> Sent: 17 November 2005 3:10 pm
>> To: PHP
>> Subject: [PHP] OS Detection
>>
>>
>>
>> Ave,
>>
>> I'm working on a Guestbook for a site and I'm trying to identify Browser &
>> Operating System of the user and eventually I'll display the Icon matching
>> the Browser/OS in the entry.
>>
>> I'm able to identify and use an If Conditional statement for the Browser,
>> but I can't seem to identify the OS.
>>
>> This is what I'm using to identify the Browser:
>>
>>
>> function browser_detection( $which_test ) {
>>
>> // initialize the variables
>> $browser = '';
>> $dom_browser = '';
>>
>> // set to lower case to avoid errors, check to see if
>> http_user_agent is set
>> $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ?
>> strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
>>
>> // run through the main browser possibilities, assign them to the main
>> $browser variable
>> if (stristr($navigator_user_agent, "opera"))
>> {
>> $browser = 'opera';
>> $dom_browser = true;
>> }
>>
>> elseif (stristr($navigator_user_agent, "msie 4"))
>> {
>> $browser = 'msie4';
>> $dom_browser = false;
>> }
>>
>> elseif (stristr($navigator_user_agent, "msie"))
>> {
>> $browser = 'msie';
>> $dom_browser = true;
>> }
>>
>> elseif ((stristr($navigator_user_agent, "konqueror")) ||
>> (stristr($navigator_user_agent, "safari")))
>> {
>> $browser = 'safari';
>> $dom_browser = true;
>> }
>>
>> elseif (stristr($navigator_user_agent, "gecko"))
>> {
>> $browser = 'mozilla';
>> $dom_browser = true;
>> }
>>
>> elseif (stristr($navigator_user_agent, "mozilla/4"))
>> {
>> $browser = 'ns4';
>> $dom_browser = false;
>> }
>>
>> else
>> {
>> $dom_browser = false;
>> $browser = false;
>> }
>>
>> // return the test result you want
>> if ( $which_test == 'browser' )
>> {
>> return $browser;
>> }
>> elseif ( $which_test == 'dom' )
>> {
>> return $dom_browser;
>> // note: $dom_browser is a boolean value, true/false, so you can
>> just test
>> if
>> // it's true or not.
>> }
>> }
>>
>> $user_browser = browser_detection('browser');
>>
>> echo "$user_browser";
>>
>> if ( $user_browser == 'opera' )
>> {
>> echo "OPERA";
>> }
>> else {
>> echo "SOMETHING ELSE";
>> }
>>
>> ?>
>>
>> Any suggestions on getting the OS ?
>>
>> Thanks,
>>
>> Rahul S. Johari
>> Coordinator, Internet & Administration
>> Informed Marketing Services Inc.
>> 251 River Street
>> Troy, NY 12180
>>
>> Tel: (518) 266-0909 x154
>> Fax: (518) 266-0909
>> Email: rahul
informed-sources.com
>> http://www.informed-sources.com
>>
>>
>
Rahul S. Johari
Coordinator, Internet & Administration
Informed Marketing Services Inc.
251 River Street
Troy, NY 12180
Tel: (518) 266-0909 x154
Fax: (518) 266-0909
Email: rahul
informed-sources.com
http://www.informed-sources.com
attached mail follows:
On Nov 17, 2005, at 10:09 AM, Rahul S. Johari wrote:
> I'm working on a Guestbook for a site and I'm trying to identify
> Browser &
> Operating System of the user and eventually I'll display the Icon
> matching
> the Browser/OS in the entry.
>
> I'm able to identify and use an If Conditional statement for the
> Browser,
> but I can't seem to identify the OS.
>
> This is what I'm using to identify the Browser:
>
>
> function browser_detection( $which_test ) {
>
> // initialize the variables
> $browser = '';
> $dom_browser = '';
>
> // set to lower case to avoid errors, check to see if http_user_agent
> is set
> $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ?
> strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
>
> // run through the main browser possibilities, assign them to the main
> $browser variable
> if (stristr($navigator_user_agent, "opera"))
> {
> $browser = 'opera';
> $dom_browser = true;
> }
[snip]
> Any suggestions on getting the OS ?
If you're using the above to match parts of the
$_SERVER["HTTP_USER_AGENT"] string, why not also use stristr() to look
for "windows", "mac", etc.?
--
Lowell Allen
attached mail follows:
None, their all messy and terribly hard to read, I would use CSS instead
of tables, that way their would be not much need to change any HTML code
incase you wanted to re-design your webpage with another style or make
slight alterations etc, HTML coders should be able to understand CSS so
would be able to identify the bits of HTML within your PHP code if it
needed changing, your code would be a lot easier to read using CSS,
easier to alter and take up roughly 25% less space.
James
attached mail follows:
<afan
afan.net> wrote in message news:437B5A85.9010901
afan.net...
> Hi to all,
> always wondered what's better way to mix html and php code. Here are three
> "ways" of the same code. Which one you prefer? (And why, of caurse :))
(snip)
> I think third solution would be the best solution?
IF you are doing a complex site, then the third option is almost mandatory.
You typically do not know what code will be in the header, until you have
processed some of the page. Building the page as-you-go, allows for easy
alteration of previously built HTML code. Complex sites are extremely
difficult to create using the "template" approach, because of the variety of
output.
I would highly agree with James Benson about CSS.
DanB
attached mail follows:
On Thu, 2005-11-17 at 14:34, Dan Baker wrote:
> <afan
afan.net> wrote in message news:437B5A85.9010901
afan.net...
> > Hi to all,
> > always wondered what's better way to mix html and php code. Here are three
> > "ways" of the same code. Which one you prefer? (And why, of caurse :))
> (snip)
> > I think third solution would be the best solution?
>
> IF you are doing a complex site, then the third option is almost mandatory.
> You typically do not know what code will be in the header, until you have
> processed some of the page. Building the page as-you-go, allows for easy
> alteration of previously built HTML code. Complex sites are extremely
> difficult to create using the "template" approach, because of the variety of
> output.
Ummm... bullturds :)
Here is an example of a layout template:
-----------------------------------------------------------------------------
<jinn:prepend/>
<html>
<head>
<title><jinn:pageTitle/></title>
<style type="text/css">
<!--
<jinn:template path="css/main.template"/>
-->
</style>
<jinn:accumulatorFlush name="javaScriptTags"/>
<jinn:accumulatorFlush name="javaScriptTags" dynamic="true"/>
<script type="text/javascript" language="javascript">
<!-- //
<jinn:accumulatorFlush name="javaScript"/>
<jinn:accumulatorFlush name="javaScript" dynamic="true"/>
function onLoadRoutines()
{
<jinn:accumulatorFlush name="javaScriptOnLoad"/>
<jinn:accumulatorFlush name="javaScriptOnLoad" dynamic="true"/>
}
// -->
</script>
</head>
<body onLoad="javascript:onLoadRoutines()" bgcolor="#ffffff"
marginheight="5" marginwidth="10" topmargin="0" l
-----------------------------------------------------------------------------
Now anywhere in the modules (which incidentally get loaded before the
content), or anywhere else in a sub-template content can be accumulated
in any of the above accumulator names. I have worked on plenty of
complex sites, and my JavaScript and other content always goes EXACTLY
where it's supposed to be, regardless of where the logic exists that
determines it's need to exist. For instance to include on load
javascript from any module:
-----------------------------------------------------------------------------
$sAcc = $this->getServiceRef( 'accManager' );
$acc = &$sAcc->getAccumulatorRef( 'javaScriptOnLoad' );
$acc->append( "alert( 'Foooooooo!' );\n" );
> I would highly agree with James Benson about CSS.
I agree CSS is great, but it's not everything. Custom tags allow one to
embed macro and meta semantics into a page without the cumbersome nature
of PHP function calls. For instance I find this meta tag handy in many
sites I create:
<project:searchable>
Some content that the site's search feature can search upon.
</project:searchable>
Another one that my designer friends REALLY like:
<project:restrict access="admin, manager">
Some content that only admin and management can view.
</project:restrict>
So templates aren't just about making pretty tables, though they can do
that quite well too.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
attached mail follows:
"Robert Cummings" <robert
interjinn.com> wrote in message
news:1132257406.18353.24.camel
blobule.suds...
> On Thu, 2005-11-17 at 14:34, Dan Baker wrote:
>> <afan
afan.net> wrote in message news:437B5A85.9010901
afan.net...
>> > Hi to all,
>> > always wondered what's better way to mix html and php code. Here are
>> > three
>> > "ways" of the same code. Which one you prefer? (And why, of caurse :))
>> (snip)
>> > I think third solution would be the best solution?
>>
>> IF you are doing a complex site, then the third option is almost
>> mandatory.
>> You typically do not know what code will be in the header, until you have
>> processed some of the page. Building the page as-you-go, allows for easy
>> alteration of previously built HTML code. Complex sites are extremely
>> difficult to create using the "template" approach, because of the variety
>> of
>> output.
>
> Ummm... bullturds :)
>
(snip)
>
> Now anywhere in the modules (which incidentally get loaded before the
> content), or anywhere else in a sub-template content can be accumulated
> in any of the above accumulator names. I have worked on plenty of
> complex sites, and my JavaScript and other content always goes EXACTLY
> where it's supposed to be, regardless of where the logic exists that
> determines it's need to exist. For instance to include on load
> javascript from any module:
Looks very good. I rescind my previous post. I haven't worked with
templates of this magnitude before.
DanB
attached mail follows:
Is there a way to test if a user has cookies turned on or not so that I can
use cookies if the user allows them and use the URL if the user does not
allow them?
attached mail follows:
Tried and true is to set a cookie and then attempt to read it, if you
cant read it then cookies are not on.
On 11/17/05, Ben Miller <benipmiller
comcast.net> wrote:
> Is there a way to test if a user has cookies turned on or not so that I can
> use cookies if the user allows them and use the URL if the user does not
> allow them?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi Ben,
Thursday, November 17, 2005, 3:26:04 PM, you wrote:
> Is there a way to test if a user has cookies turned on or not so
> that I can use cookies if the user allows them and use the URL if
> the user does not allow them?
Set one? :)
Then check if it exists or not.
This of course will not catch those sneaky buggers who disable cookies
part way through your site just to see what effect it will have.
Cheers,
Rich
--
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk
attached mail follows:
On Thu, 2005-11-17 at 10:33, Richard Davey wrote:
> Hi Ben,
>
> Thursday, November 17, 2005, 3:26:04 PM, you wrote:
>
> > Is there a way to test if a user has cookies turned on or not so
> > that I can use cookies if the user allows them and use the URL if
> > the user does not allow them?
>
> Set one? :)
>
> Then check if it exists or not.
>
> This of course will not catch those sneaky buggers who disable cookies
> part way through your site just to see what effect it will have.
*lol* I do that sometimes... with Javascript too.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
attached mail follows:
Hi Robert,
Thursday, November 17, 2005, 3:39:43 PM, you wrote:
> *lol* I do that sometimes... with Javascript too.
:) it's amazing what you can break by doing that!
Cheers,
Rich
--
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk
attached mail follows:
You can check on every page load, but I'm sure thats over kill for
most public facing sites to catch some Yahoos who have too much time
on their hands.
On 11/17/05, Richard Davey <rich
corephp.co.uk> wrote:
> Hi Ben,
>
> Thursday, November 17, 2005, 3:26:04 PM, you wrote:
>
> > Is there a way to test if a user has cookies turned on or not so
> > that I can use cookies if the user allows them and use the URL if
> > the user does not allow them?
>
> Set one? :)
>
> Then check if it exists or not.
>
> This of course will not catch those sneaky buggers who disable cookies
> part way through your site just to see what effect it will have.
>
> Cheers,
>
> Rich
> --
> Zend Certified Engineer
> PHP Development Services
> http://www.corephp.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi Dan,
Thursday, November 17, 2005, 3:56:43 PM, you wrote:
> You can check on every page load, but I'm sure thats over kill for
> most public facing sites to catch some Yahoos who have too much time
> on their hands.
Is that a new technical term for 'hacker' ? :)
Cheers,
Rich
--
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk
attached mail follows:
:) why of course
On 11/17/05, Richard Davey <rich
corephp.co.uk> wrote:
> Hi Dan,
>
> Thursday, November 17, 2005, 3:56:43 PM, you wrote:
>
> > You can check on every page load, but I'm sure thats over kill for
> > most public facing sites to catch some Yahoos who have too much time
> > on their hands.
>
> Is that a new technical term for 'hacker' ? :)
>
> Cheers,
>
> Rich
> --
> Zend Certified Engineer
> PHP Development Services
> http://www.corephp.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi Ben,
Thursday, November 17, 2005, 3:26:04 PM, you wrote:
> Is there a way to test if a user has cookies turned on or not so
> that I can use cookies if the user allows them and use the URL if
> the user does not allow them?
Set one? :)
Then check if it exists or not.
This of course will not catch those sneaky buggers who disable cookies
part way through your site just to see what effect it will have.
Cheers,
Rich
--
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
In order to set one and then check if it exists or not, I have to set it on
one page, and then test it on the next page load - In this case, I don't
figure out how I need to send information from page to page until they have
already gone to another page, at which point, the test is no longer needed.
I was hoping there might be a browser variable or something like that that
would tell right away if cookies are turned on or not. If there is not,
perhaps this is something we should lobby the browsers to get?
attached mail follows:
Hi Ben,
Thursday, November 17, 2005, 4:24:11 PM, you wrote:
> In order to set one and then check if it exists or not, I have to
> set it on one page, and then test it on the next page load - In this
> case, I don't figure out how I need to send information from page to
> page until they have already gone to another page, at which point,
> the test is no longer needed.
You don't have to set / test one on a *PAGE* at all, just from a PHP
script (these are not always the same thing).
Cheers,
Rich
--
Zend Certified Engineer
PHP Development Services
http://www.corephp.co.uk
attached mail follows:
On Nov 15, 2005, at 12:07 PM, Ben Miller wrote:
> I am trying to learn how to work with arrays, and have the basic
> concept
> down for working within a single page, but I am having trouble sending
> an
> array from one page to another. For example, I can send a variable
> from
> page to page using either the URL, such as www.domain.com/?foo=bar, or
> using
> a form, but can I send an array from one page to another using a form
> so
> that all the values in the array will be sent?
[snip]
If you don't want to use session variables (as already suggested), you
can serialize the array, then send as a hidden form value:
<http://us2.php.net/manual/en/function.serialize.php>
You may need to also encode the serialized value:
<http://us2.php.net/manual/en/function.base64-encode.php>
HTH
--
Lowell Allen
attached mail follows:
"Scott Parks" <scottaparks
gmail.com> wrote in message
news:95ECBB2B-8A48-4D28-A381-A1450C394D4B
gmail.com...
> Hi-
>
> I have a number that I am trying to format. It is data coming from a
> main frame and
> has 8 characters assigned to it (6 and two decimal places). I have
> zerofill set up in
> MySQL on this field and am working on the best way to display the number.
>
> Currently I have this:
>
> $sOutput = number_format(rtrim($sValue,'0') /100,2);
>
> What I am running into is this, I have a number in this field as:
> 3145900, using the above I will get: 314.59, which is wrong, it
> needs to be 3,145.90.
>
> Yet, if I have a number of: 749450, I get the result I am looking for
> of 749.45.
>
> I did not see a way to tell trim I only want one 0 cut?
Just convert the string into a number, and work with it as a number:
// first, convert the string into a number (assuming 3 decimals, as your
example shows)
$nValue = floatval($sValue) / 1000;
// then, format it
$sOutput = number_format($nNumber, 2);
DanB
attached mail follows:
How can I check to see if a string var holds a number? Is regex the
only way to do this? For example I have code where the var could hold
"10" or "ten". If the string is a number, do one thing, if it isn't
do something else. is_int doesn't work, intval converts "ten" to a
number so that doesn't work....
Thanks!
attached mail follows:
blackwater dev said the following on 11/17/2005 11:37 AM:
> How can I check to see if a string var holds a number? Is regex the
> only way to do this? For example I have code where the var could hold
> "10" or "ten". If the string is a number, do one thing, if it isn't
> do something else. is_int doesn't work, intval converts "ten" to a
> number so that doesn't work....
is_numeric
http://ca.php.net/is_numeric
- Ben
attached mail follows:
On Thu, Nov 17, 2005 at 02:37:49PM -0500, blackwater dev wrote:
> How can I check to see if a string var holds a number? Is regex the
> only way to do this? For example I have code where the var could hold
> "10" or "ten". If the string is a number, do one thing, if it isn't
> do something else. is_int doesn't work, intval converts "ten" to a
> number so that doesn't work....
http://php.net/ctype_digit
Curt.
--
attached mail follows:
Which version of PHP are you using? On php 4.4.0 (SuSE 10.0 default RPM, not
custom build, so perhaps I'm missing some extras you're using?) the following
script works fine:
<?php
if (10==intval("ten")) echo "boo\n"; else echo "no boo\n";
?>
I get no boo. intval doesn't convert my "ten" to a number. Moreover, the
output of the following:
<?php
echo intval("ten");
?>
produces an expected (by me) 0.
On Thursday 17 November 2005 20:37, blackwater dev wrote:
> do something else. is_int doesn't work, intval converts "ten" to a
> number so that doesn't work....
>
> Thanks!
attached mail follows:
If I misunderstood the intval part of your post, than the [proposed already]
is_numeric solutions are the way to go. is_numeric will, however, unlike the
conversion functions, return false if there's anything but a number in the
string, so, i.e., is_numeric ("10a1") will return false, but intval ("10a1")
will give "10".
attached mail follows:
Curt,
yes, technically, 0 is a number - it's a bit late here, and I believe I
mis-understood the original question, which is why I re-posted in the thread.
I guess my mind got a bit confused by the combination of "is_int doesn't
work", "intval returns a number" and "'10' vs 'ten'" example.
That's probably due to the fact I normally rely on intval() to do the job
for integers, which also helps "remove" some user mis-types at the end of
number fields, which is useful in situations when
A) you're ok with the user typing 11l when they mean 111
B) you don't want to accept a value of 0
In principle, that's the only problem with "intval" - a "0" will evaluate
as false in a logical statement. Unless one wants to make sure it's a full
number from start to end, of course...
Max.
On Thursday 17 November 2005 23:05, you wrote:
> On Thu, Nov 17, 2005 at 08:47:30PM +0100, Max Belushkin wrote:
> > extras you're using?) the following script works fine:
> >
> > <?php
> > if (10==intval("ten")) echo "boo\n"; else echo "no boo\n";
> > ?>
> >
> > I get no boo. intval doesn't convert my "ten" to a number.
> > Moreover, the output of the following:
>
> Yes it does.
>
> echo intval('a'); // 0
> echo intval('0'); // 0
> echo intval(0); // 0
> echo intval(0.1); // 0
>
> $v = intval('ten');
> var_dump($v); // int(0)
>
> $v = intval('10');
> var_dump($v); // int(10)
>
> Curt.
attached mail follows:
Hi list,
Does anyone have any information/updates on this issue perhaps? The thread
on http://lists.freebsd.org/pipermail/freebsd-ports/2005-November/027056.html
hasn't had anything new (since Nov 6), and on
http://bugs.php.net/bug.php?id=35059 it's been stated as "fixed" ever since
(Nov 2).
The FreeBSD php port doesn't seem to have moved past 4.1.1_1, which, as the
thread implies, still has the problem, and since the PHP CVS commit was made
4 days before that, I'm [wildly] guessing that "fix" was already consumed...
On a side note, has anyone had an issue with PHP and mod_rewrite of the same
nature on a non-FreeBSD install?
Thanks!
Max.
On Tuesday 08 November 2005 21:07, Geert Booster wrote:
> I've seen this problem on a FreeBSD 5.3 machine with Apache2 and PHP
> 4.4.1_1. The problem looks to be a problem with mod_rewrite and PHP,
> because the different scripts (MovebleType, Gallery2, Dokuwiki)
> are rewriting and getting the same errors.
>
> Maybe the following [1] thread on the FreeBSD ports lists does help you.
> I (and the other sysops/users of this machine) are waiting for a patch
> for this problem
> (By PHP developers or maybe the FreeBSD porters, it could be a FreeBSD
> issue) because we don't want to go back to 4.4.0 when it's not needed
> (critically fixes in 4.4.1..)
>
> You're not the only one :-)
>
> [1]
> http://lists.freebsd.org/pipermail/freebsd-ports/2005-November/027038.html
>
>
> Yours sincerely,
>
> Geert Booster
>
> --
> Geert Booster
> geert
webboost.nl
attached mail follows:
Hello,
I am seeing Apache segmentation faults with some processes which turn
out to be php related. This is a newly upgraded Apache from Apache
2.0.54 to Apache 2.0.55. The scripts that are failing with the new
Apache work with no problems with the old Apache.
Traceback from Apache is below.
Let me know if I should provide any more info. php version is 4.3.10,
and linux distro is fedora core 3 - php and apache are both compiled
from source, not installed from rpm.
Thanks,
Kristina
#0 zend_hash_index_update_or_next_insert (ht=0xb7d247a0, h=4, pData=0xbfffec70,
nDataSize=12, pDest=0x0, flag=1) at
/usr/local/src/php-4.3.10/Zend/zend_hash.c:392
nIndex = 4
p = (Bucket *) 0x7068702e
#1 0xb7c6bf23 in zend_list_insert (ptr=0x9b57ba4, type=162888612)
at /usr/local/src/php-4.3.10/Zend/zend_list.c:45
index = 4
le = {ptr = 0xda1a0c4, type = 2, refcount = 1}
#2 0xb7c6c05e in zend_register_resource (rsrc_result=0x0,
rsrc_pointer=0xda1a0c4,
rsrc_type=2) at /usr/local/src/php-4.3.10/Zend/zend_list.c:98
rsrc_id = 162888612
#3 0xb7c452f8 in _php_stream_alloc (ops=0x9b57ba4, abstract=0x9b57ba4,
persistent_id=0x0, mode=0xb762f895 "rb")
at /usr/local/src/php-4.3.10/main/streams.c:281
le = {ptr = 0x24, type = 1126289980, refcount = 797960056}
ret = (php_stream *) 0xda1a0c4
#4 0xb7c46b06 in _php_stream_fopen_from_fd (fd=16, mode=0xb762f895 "rb",
persistent_id=0x0) at /usr/local/src/php-4.3.10/main/streams.c:2067
self = (php_stdio_stream_data *) 0x9c0871c
stream = (php_stream *) 0x9c08730
sb = {st_dev = 16, __pad1 = 0, st_ino = 3230021650, st_mode = 33188,
st_nlink = 1, st_uid = 42807, st_gid = 100, st_rdev = 0, __pad2 = 0,
st_size = 1179, st_blksize = 32768, st_blocks = 8, st_atim = {tv_sec
= 1124473602,
tv_nsec = 315743024}, st_mtim = {tv_sec = 1126289980, tv_nsec = 797960056},
st_ctim = {tv_sec = 1126289980, tv_nsec = 799959752}, __unused4 = 0,
__unused5 = 0}
#5 0xb7c46c9d in _php_stream_fopen (
filename=0xda143d8 "/home/serve/STJOSEPHGC/eventsdb.php",
mode=0xb762f895 "rb",
opened_path=0xbffff1a8, options=165)
at /usr/local/src/php-4.3.10/main/streams.c:1999
realpath = 0xd993454 "/mnt/nfs/STJOSEPHGC/eventsdb.php"
st = {st_dev = 16, __pad1 = 0, st_ino = 3230021650, st_mode = 33188,
st_nlink = 1, st_uid = 42807, st_gid = 100, st_rdev = 0, __pad2 = 0,
st_size = 1179, st_blksize = 32768, st_blocks = 8, st_atim = {tv_sec
= 1124473602,
tv_nsec = 315743024}, st_mtim = {tv_sec = 1126289980, tv_nsec = 797960056},
st_ctim = {tv_sec = 1126289980, tv_nsec = 799959752}, __unused4 = 0,
__unused5 = 0}
open_flags = 0
fd = 16
ret = (php_stream *) 0x0
persistent = 16
persistent_id = 0x0
#6 0xb7c47fb5 in php_plain_files_stream_opener (wrapper=0xb7cf3dc4,
path=0xda143d8 "/home/serve/STJOSEPHGC/eventsdb.php", mode=0xb762f895 "rb",
options=165, opened_path=0xbffff1a8, context=0x0)
at /usr/local/src/php-4.3.10/main/streams.c:2463
No locals.
#7 0xb7c485dc in _php_stream_open_wrapper_ex (
path=0xda143d8 "/home/serve/STJOSEPHGC/eventsdb.php", mode=0xb762f895 "rb",
options=173, opened_path=0xa5, context=0x0)
at /usr/local/src/php-4.3.10/main/streams.c:2660
stream = (php_stream *) 0x0
wrapper = (php_stream_wrapper *) 0xb7cf3dc4
path_to_open = 0xda143d8 "/home/serve/STJOSEPHGC/eventsdb.php"
#8 0xb75d84ce in ?? ()
from /home/sys/Zend/lib/Optimizer-2.5.7/php-4.3.x/ZendOptimizer.so
No symbol table info available.
#9 0x0da143d8 in ?? ()
No symbol table info available.
#10 0xb762f895 in ?? ()
from /home/sys/Zend/lib/Optimizer-2.5.7/php-4.3.x/ZendOptimizer.so
No symbol table info available.
---Type <return> to continue, or q <return> to quit---
#11 0x000000ad in ?? ()
No symbol table info available.
#12 0xbffff1a8 in ?? ()
No symbol table info available.
#13 0x00000000 in ?? ()
No symbol table info available.
attached mail follows:
I have had various problems with upgrading one or the other, until I took it
as a rule to recompile both upon an upgrade. On the machine I do things
completely manually on [which has it's drawbacks], I generally also upgrade
to the current version of PHP together with any Apache update, and
vice-versa. The current 4.x version is 4.4.1 [although on a FreeBSD install I
had some issues and downgraded to 4.4.0, but this behaviour hasn't been
confirmed outside of FreeBSD until now] - perhaps try recompiling PHP to the
current 4.x version (or if you feel up to it, upgrade to the 5.x versions?),
and see if it helps? Resolved a lot of my problems in the past...
On Thursday 17 November 2005 22:31, kristina clair wrote:
> 2.0.54 to Apache 2.0.55. The scripts that are failing with the new
> Apache work with no problems with the old Apache.
attached mail follows:
I actually did that before emailing about php 4.3.10. With php 4.4.1,
the traceback is different:
Reading symbols from /home/sys/Zend/lib/ZendExtensionManager.so...done.
Loaded symbols for /home/sys/Zend/lib/ZendExtensionManager.so
Error while reading shared library symbols:
.//home/sys/Zend/etc/pfpro.so: No such file or directory.
Reading symbols from /home/sys/verisign/lib/libpfpro.so...done.
Loaded symbols for /usr/local/verisign//lib/libpfpro.so
#0 0xb7ca0c15 in php_handler (r=0xda05f90)
at /home/sys/src/php-4.4.1/sapi/apache2handler/sapi_apache2.c:538538
if (parent_req && strcmp(parent_req->handler,
PHP_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE)
&& strcmp(parent_req->handler, PHP_SCRIPT)) {
warning: not using untrusted file ".gdbinit"
(gdb) bt full
#0 0xb7ca0c15 in php_handler (r=0xda05f90)
at /home/sys/src/php-4.4.1/sapi/apache2handler/sapi_apache2.c:538
orig_bailout = {{__jmpbuf = {0, 0, 0, 0, 0, 0}, __mask_was_saved = 0,
__saved_mask = {__val = {0 <repeats 32 times>}}}}
ctx = (php_struct *) 0xd9e9a80
conf = Variable "conf" is not available.
(gdb)
On 11/17/05, Max Belushkin <m.belushkin
fz-juelich.de> wrote:
> I have had various problems with upgrading one or the other, until I took it
> as a rule to recompile both upon an upgrade. On the machine I do things
> completely manually on [which has it's drawbacks], I generally also upgrade
> to the current version of PHP together with any Apache update, and
> vice-versa. The current 4.x version is 4.4.1 [although on a FreeBSD install I
> had some issues and downgraded to 4.4.0, but this behaviour hasn't been
> confirmed outside of FreeBSD until now] - perhaps try recompiling PHP to the
> current 4.x version (or if you feel up to it, upgrade to the 5.x versions?),
> and see if it helps? Resolved a lot of my problems in the past...
>
> On Thursday 17 November 2005 22:31, kristina clair wrote:
> > 2.0.54 to Apache 2.0.55. The scripts that are failing with the new
> > Apache work with no problems with the old Apache.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
"In most cases, people, even wicked people, are far more naive and
simple-hearted than one generally assumes. And so are we."
/* last line, 1st ch., The Brothers Karamazov */
attached mail follows:
and possibly with heavy (php5) OO code?
I'm getting intermittent segfaults with 5.0.4, 5.0.5
when using apc_fetch() and apc_store() - caching of all opcodes
[by setting the ini setting 'apc.enabled' to 1] works fine.
I just tried with php5.1RC5 and it just segfaults on every request,
with or without the use of apc_fetch()/apc_store()
I was wondering whether any one has any tips or a clue as
to starting to debug (and hopefully) fix this?
rgds,
jochem
attached mail follows:
I'm having an issue with cURL. I have installed it on two different boxes, one is working properly, and another isn't.
The script auto login's a user to a site. One server it works as expected and logs the user in, the other it does not. It appears the cookie data that is being saved is different on the two machines from the login.
The code itself is identical. The result on the two servers is different. I've fiddled with this thing for a couple weeks, and now its too late to mess with it anymore as I have a launch target I need to hit.
What I'd like is a php / IIS guru to help me fix this. I will give you remote desktop access to the server and you can take it away from there. I just need you to get the script running on the server the same as the other. The script is already there, its very simplistic, only about 50 lines or so, no database interaction, nothing fancy at all. I'm not a strong PHP guy, so its very simplistic. (again though, it works on other server, so its not a code issue)
In return, I'll give you free hosting on one of my dedicated servers for 6 months. This is not your average shared hosting, I dont host sites for a living, I only host clients I code for - so there is only a handful of people on each server. In fact, the server you will be on, you will be the only person on it at this time. You'll have access to PHP (obviously), ColdFusion MX 7 (the latest, greatest version), MSSQL 2k and/or mySQL (different server), and if you need additional services, we can work that out.
Please email me if you are interested in helping or if you have any ideas please!!
Thanks in advance!
- Nate Nielsen
nnielsen
cfgod.com
attached mail follows:
also, as another note - the php version and cURL version is identical on the
two machines - the main difference between them being that one is windows 2k
server and the other one is windows 2k3 server (std ed)
any ideas ?
thanks
----- Original Message -----
From: "Nate Nielsen" <nnielsen
cfgod.com>
To: <php-general
lists.php.net>
Sent: Thursday, November 17, 2005 4:00 PM
Subject: [PHP] php + cURL issue
I'm having an issue with cURL. I have installed it on two different boxes,
one is working properly, and another isn't.
The script auto login's a user to a site. One server it works as expected
and logs the user in, the other it does not. It appears the cookie data
that is being saved is different on the two machines from the login.
The code itself is identical. The result on the two servers is different.
I've fiddled with this thing for a couple weeks, and now its too late to
mess with it anymore as I have a launch target I need to hit.
What I'd like is a php / IIS guru to help me fix this. I will give you
remote desktop access to the server and you can take it away from there. I
just need you to get the script running on the server the same as the other.
The script is already there, its very simplistic, only about 50 lines or so,
no database interaction, nothing fancy at all. I'm not a strong PHP guy, so
its very simplistic. (again though, it works on other server, so its not a
code issue)
In return, I'll give you free hosting on one of my dedicated servers for 6
months. This is not your average shared hosting, I dont host sites for a
living, I only host clients I code for - so there is only a handful of
people on each server. In fact, the server you will be on, you will be the
only person on it at this time. You'll have access to PHP (obviously),
ColdFusion MX 7 (the latest, greatest version), MSSQL 2k and/or mySQL
(different server), and if you need additional services, we can work that
out.
Please email me if you are interested in helping or if you have any ideas
please!!
Thanks in advance!
- Nate Nielsen
nnielsen
cfgod.com
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]