[PHP] error_log() bug on PHP 5.4.11?
Hi, When I call error_log() to log a message to the log file, I end up with duplicate entries. Here is a minimal test script which reproduces the problem for me: ?php ini_set('error_log', 'C:\Apache2\htdocs\myapp\app\logs\error_log'); error_log('some log message that, via a bug, will be logged twice'); ? will log: [30-Jan-2013 09:41:13 UTC] some log message that, via a bug, will be logged twice [30-Jan-2013 09:41:13 UTC] some log message that, via a bug, will be logged twice If it matters, I am running the VC9 x86 Thread Safe build of PHP 5.4.11 on a Windows XP box but I had seen this problem in PHP 5.3.6 as well. I am running Apache 2.2 for Web server. Can somebody confirm whether this is a bug? I checked the bug database on php.net but did not find anything relevant. Best regards J.S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTC on php log bug
On Fri, Aug 24, 2012 at 8:48 PM, Martín Marqués martin.marq...@gmail.com wrote: Whats up with this bug?: https://bugs.php.net/bug.php?id=60723 perhaps direct the query (such as it is) to php-development -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UTC on php log bug
Whats up with this bug?: https://bugs.php.net/bug.php?id=60723 -- Martín Marqués select 'martin.marques' || '@' || 'gmail.com' DBA, Programador, Administrador -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug?
On 09/15/2011 04:07 PM, Igor Escobar wrote: Anyone can explain this? https://gist.github.com/1220404 Part of the code are in portuguese so... iguais = equal diferentes = different Regards, Igor Escobar *Software Engineer * + http://blog.igorescobar.com + http://www.igorescobar.com + @igorescobar http://www.twitter.com/igorescobar 1. Obviously because of the issues with floating point precision these are stored as the same float, a la your next example. 2. Using bc math for binary calculations on string representations of a number overcomes the problems in 1. 3. This one is peculiar, but it seems that since they are numeric strings that they are being juggled to float for the comparison since using == there is no type checking. Using === yields a different result, presumably because forcing a type check compares them as strings. Use strcmp() to overcome this. 4. Do I need to explain this one? -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug?
Thank you guys. Regards, Igor Escobar *Software Engineer * + http://blog.igorescobar.com + http://www.igorescobar.com + @igorescobar http://www.twitter.com/igorescobar On Thu, Sep 15, 2011 at 6:32 PM, Shawn McKenzie nos...@mckenzies.netwrote: On 09/15/2011 04:07 PM, Igor Escobar wrote: Anyone can explain this? https://gist.github.com/1220404 Part of the code are in portuguese so... iguais = equal diferentes = different Regards, Igor Escobar *Software Engineer * + http://blog.igorescobar.com + http://www.igorescobar.com + @igorescobar http://www.twitter.com/igorescobar 1. Obviously because of the issues with floating point precision these are stored as the same float, a la your next example. 2. Using bc math for binary calculations on string representations of a number overcomes the problems in 1. 3. This one is peculiar, but it seems that since they are numeric strings that they are being juggled to float for the comparison since using == there is no type checking. Using === yields a different result, presumably because forcing a type check compares them as strings. Use strcmp() to overcome this. 4. Do I need to explain this one? -- Thanks! -Shawn http://www.spidean.com
Re: [PHP] Re: Bug #51739 tricky string to float conversion
Am Mittwoch, 31. August 2011, 20:48:37 schrieb Shawn McKenzie: On 08/31/2011 09:03 AM, magic-...@damage.devloop.de wrote: Hi, I have opend Bug #51739 in 2010. It was closed as bogus before my last question was answered. It would be fine to know what you think about that bug. In short: var_dump((float)8315e839da08e2a7afe6dd12ec58245d); results in float(INF) This is because 8315 is treated as base and e839da08e2a7afe6dd12ec58245d is treated as an exponent. My hint that e839da08e2a7afe6dd12ec58245d is not a valid exponent was not answered. What do you think about? cheers Daniel The cast to float is truncating the invalid characters and since your string contains a float that is INF (8315e839) before the truncation at the d, then it returns INF. Makes perfect sense. This is what drives me crazy. If I use a string in PHP I don't want PHP to cut this string. Either it uses this string as it is or it gives me an error/warning/false (what ever...). But silently(!!!) using a small piece of a string is not understandable. cheers Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug #51739 tricky string to float conversion
On 08/31/2011 09:03 AM, magic-...@damage.devloop.de wrote: Hi, I have opend Bug #51739 in 2010. It was closed as bogus before my last question was answered. It would be fine to know what you think about that bug. In short: var_dump((float)8315e839da08e2a7afe6dd12ec58245d); results in float(INF) This is because 8315 is treated as base and e839da08e2a7afe6dd12ec58245d is treated as an exponent. My hint that e839da08e2a7afe6dd12ec58245d is not a valid exponent was not answered. What do you think about? cheers Daniel The cast to float is truncating the invalid characters and since your string contains a float that is INF (8315e839) before the truncation at the d, then it returns INF. Makes perfect sense. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug #51739 tricky string to float conversion
On 08/31/2011 01:48 PM, Shawn McKenzie wrote: The cast to float is truncating the invalid characters and since your string contains a float that is INF (8315e839) before the truncation at the d, then it returns INF. Makes perfect sense. Just FYI... Don't post your troubles or misunderstandings as bug reports. The PHP developers sift through too many reports as it is and many or maybe the majority are support tickets like yours that are not bugs. The people assigned to bugs are not going to explain why your issue is not a bug in detail. They are tasked with fixing bugs, and they have many bug reports (mostly like yours). The appropriate place for you to post would be here on this list first. If the consensus of the veteran folks on this list is wow, that's a bug or some such, then we will tell you to post a bug report. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Possible bug in PHP 5.3.5 with OAuth extension?
Hello, I'm using the PHP OAuth extension and running into a strange issue. I'm not sure if it's a bug in PHP 5.3.5, or if it's a bug in the OAuth extension when installed on a system with PHP 5.3.5. On a machine with PHP 5.3.5, when I call OAuth::fetch() with http method of POST, the debug info is showing that it is sending as a GET request. As a result, the resource that I'm fetching returns with failure since it will only respond to a POST request. I tested this out on two different machines, and getting the same result on both. One machine is Ubuntu 10.04 with nginx 0.8.54 and PHP 5.3.5. The other is CentOS 5.5 with apache 2.2 and PHP 5.3.5. I have another Ubuntu 10.04 machine with PHP 5.3.3, and I am not having this issue on that machine. The OAuth debug info is correctly showing http method of POST. I guess I'll need to use PHP 5.3.3 in the mean time, but it would be great to know what the problem is. Thanks, daniel
[PHP] imagerotate bug?
Can anybody email me off-list to comment on whether the bug demonstrated here for imagerotate is fixed in current PHP? http://6112northwolcott.com/dogfight/rotate.htm All the backgrounds should be white, not black. I can't easily test on a newer version of PHP at the moment. -- Some people ask for gifts here. I just want you to buy an Indie CD for yourself: http://cdbaby.com/search/from/lynch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php bug from 2003 still alive?!
Hello, I am experiencing problems with utf-8 and php. There seems to be a problem with BOM. Some postings say that I have to compile php with --enable-zend-multibyte. HOwever those postings are very old (2003!). http://bugs.php.net/bug.php?id=22108 Is this still necessary with the newest php build? If yes, do you believe I will run into trouble on sites that are saved in ansi? Thank you for any hint. Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php bug from 2003 still alive?!
On Mon, Mar 30, 2009 at 12:42 PM, Merlin Morgenstern merli...@fastmail.fmwrote: Some postings say that I have to compile php with --enable-zend-multibyte. HOwever those postings are very old (2003!). http://bugs.php.net/bug.php?id=22108 Did you see what Derick said abut this in the last comment? * [22 Aug 2005 6:35pm UTC] der...@php.net* This will come with Unicode support in PHP 6.0 Is this still necessary with the newest php build? Looks like it. If yes, do you believe I will run into trouble on sites that are saved in ansi? I'm not sure, you should probably wait for someone else to reply :) Regards, Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com
Re: [PHP] php bug from 2003 still alive?!
Yes I was reading about this. However, try to do a search on this: http://www.google.de/search?hl=deq=enable-zend-multibytebtnG=Google-Suchemeta= Loads of postings that do not look that good. What are all the chinese sites do? It is strange that there is no official description on php.net regarding this support. Thiago H. Pojda wrote: On Mon, Mar 30, 2009 at 12:42 PM, Merlin Morgenstern merli...@fastmail.fmwrote: Some postings say that I have to compile php with --enable-zend-multibyte. HOwever those postings are very old (2003!). http://bugs.php.net/bug.php?id=22108 Did you see what Derick said abut this in the last comment? * [22 Aug 2005 6:35pm UTC] der...@php.net* This will come with Unicode support in PHP 6.0 Is this still necessary with the newest php build? Looks like it. If yes, do you believe I will run into trouble on sites that are saved in ansi? I'm not sure, you should probably wait for someone else to reply :) Regards, Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UTF 8 support - enable-zend-multibyte ( was Re: [PHP] php bug from 2003 still alive?! - )
HI there, I now compiled php with zend multibyte. The trouble with the extra characters is now gone, but all special characters are now replaced with a questionmark! The document type shows utf-8, but somehow php seems not to pars the content OK. Does nobody have the same problem? Regards, Merlin Merlin Morgenstern wrote: Yes I was reading about this. However, try to do a search on this: http://www.google.de/search?hl=deq=enable-zend-multibytebtnG=Google-Suchemeta= Loads of postings that do not look that good. What are all the chinese sites do? It is strange that there is no official description on php.net regarding this support. Thiago H. Pojda wrote: On Mon, Mar 30, 2009 at 12:42 PM, Merlin Morgenstern merli...@fastmail.fmwrote: Some postings say that I have to compile php with --enable-zend-multibyte. HOwever those postings are very old (2003!). http://bugs.php.net/bug.php?id=22108 Did you see what Derick said abut this in the last comment? * [22 Aug 2005 6:35pm UTC] der...@php.net* This will come with Unicode support in PHP 6.0 Is this still necessary with the newest php build? Looks like it. If yes, do you believe I will run into trouble on sites that are saved in ansi? I'm not sure, you should probably wait for someone else to reply :) Regards, Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF 8 support - enable-zend-multibyte ( was Re: [PHP] php bug from 2003 still alive?! - )
On Mon, Mar 30, 2009 at 12:34 PM, Merlin Morgenstern merli...@fastmail.fm wrote: HI there, I now compiled php with zend multibyte. The trouble with the extra characters is now gone, but all special characters are now replaced with a questionmark! The document type shows utf-8, but somehow php seems not to pars the content OK. Does nobody have the same problem? Regards, Merlin Please stop top-posting. Anyway, are you using a META tag codepage to tell the web browser what to do with those special characters? I'm not certain a DOCTYPE is going to handle everything. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF 8 support - enable-zend-multibyte ( was Re: [PHP] php bug from 2003 still alive?! - )
haliphax wrote: On Mon, Mar 30, 2009 at 12:34 PM, Merlin Morgenstern merli...@fastmail.fm wrote: HI there, I now compiled php with zend multibyte. The trouble with the extra characters is now gone, but all special characters are now replaced with a questionmark! The document type shows utf-8, but somehow php seems not to pars the content OK. Does nobody have the same problem? Regards, Merlin Please stop top-posting. Anyway, are you using a META tag codepage to tell the web browser what to do with those special characters? I'm not certain a DOCTYPE is going to handle everything. HI, I am using a meta tag: meta http-equiv=content-type content=text/html; charset=UTF-8 I have also configured apache: AddDefaultCharset utf-8 Also php: header('content-type: text/html; charset=utf-8'); Header: HTTP/1.x 200 OK Date: Mon, 30 Mar 2009 19:14:22 GMT Server: Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8h PHP/5.2.9 X-Powered-By: PHP/5.2.9 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=utf-8 The chinese characters which come directly out of the database are shown corretly. The chinese chars that are saved in a text file show up as a question mark. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unpack bug?
Hi, I have some code developed on a linux system with PHP 5.1.6, its using the PEAR Net_DNS class to send dns updates, part of this requires unpacking a binary string, an example is below. This works on PHP 5.1.6 but fails on 5.2.8, it appears that it may be in relation to the following change in 5.2.4 Added missing format validator to unpack(). A test case of the code is as follows: $data = base64_decode(A86pgAABCHJuZGMta2V5AAD6AP8AADoIaG1hYy1tZDUHc2lnLWFsZwNyZWcDaW50SW8kgAEsABBd7hm4xnUjl5kWLXfbZKaBA84A); $offset=58; $d = unpack('\...@$offset/nth/Ntl/nfudge/nmac_size', $data); print_r($d); Expected output: Array ( [th] = 974 [tl] = -1451229184 [fudge] = 0 [mac_size] = 0 ) Actual output: Warning: unpack(): Invalid format type \ Removing the \ before that @ does make the error go away but causes a different result: Array ( [th] = 52905 [tl] = -2147483648 [fudge] = 0 [mac_size] = 0 ) Is this being caused by the format validator and if so should it be allowing this, or is there another way I can unpack this correctly. Regards James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] de-bug no input file specified
Hi, is it possible to de-bug a 'no input file specified' error. I get the error when trying to run my search script but do not know whats causing it. Is it a common error? PHP5 with MySQL adn IIS7 Thanks - Gary -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de-bug no input file specified
On December 19, 2008 17:20:32 Gary Maddock-Greene wrote: Hi, is it possible to de-bug a 'no input file specified' error. I get the error when trying to run my search script but do not know whats causing it. Is it a common error? What code/command/request is causing the error? PHP5 with MySQL adn IIS7 Thanks - Gary -- Philip Graham Lightbox Technologies Suite 312 240 Catherine St. Ottawa, ON, K2P 2G8 613-686-1661 ext. 102 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de-bug no input file specified
Hi Philip, Here is my code ... ?php if (!function_exists(GetSQLValueString)) { function GetSQLValueString($theValue, $theType, $theDefinedValue = , $theNotDefinedValue = ) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists(mysql_real_escape_string) ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case text: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case long: case int: $theValue = ($theValue != ) ? intval($theValue) : NULL; break; case double: $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' : NULL; break; case date: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case defined: $theValue = ($theValue != ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rsSearch = -1; if (isset($_GET['product_name'])) { $colname_rsSearch = $_GET['product_name']; } mysql_select_db($database_MyDatabase, $MyDatabase); $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $MyDatabase) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? - Gary Philip Graham phi...@lightbox.org wrote in message news:200812191734.10664.phi...@lightbox.org... On December 19, 2008 17:20:32 Gary Maddock-Greene wrote: Hi, is it possible to de-bug a 'no input file specified' error. I get the error when trying to run my search script but do not know whats causing it. Is it a common error? What code/command/request is causing the error? PHP5 with MySQL adn IIS7 Thanks - Gary -- Philip Graham Lightbox Technologies Suite 312 240 Catherine St. Ottawa, ON, K2P 2G8 613-686-1661 ext. 102 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de-bug no input file specified
first off - you must be coming from ASP for that code :P second - that error is usually due to the SCRIPT_FILENAME being incorrect. not the code in the script. On Fri, Dec 19, 2008 at 2:54 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Hi Philip, Here is my code ... ?php if (!function_exists(GetSQLValueString)) { function GetSQLValueString($theValue, $theType, $theDefinedValue = , $theNotDefinedValue = ) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists(mysql_real_escape_string) ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case text: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case long: case int: $theValue = ($theValue != ) ? intval($theValue) : NULL; break; case double: $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' : NULL; break; case date: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case defined: $theValue = ($theValue != ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rsSearch = -1; if (isset($_GET['product_name'])) { $colname_rsSearch = $_GET['product_name']; } mysql_select_db($database_MyDatabase, $MyDatabase); $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $MyDatabase) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? - Gary Philip Graham phi...@lightbox.org wrote in message news:200812191734.10664.phi...@lightbox.org... On December 19, 2008 17:20:32 Gary Maddock-Greene wrote: Hi, is it possible to de-bug a 'no input file specified' error. I get the error when trying to run my search script but do not know whats causing it. Is it a common error? What code/command/request is causing the error? PHP5 with MySQL adn IIS7 Thanks - Gary -- Philip Graham Lightbox Technologies Suite 312 240 Catherine St. Ottawa, ON, K2P 2G8 613-686-1661 ext. 102 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de-bug no input file specified
the code was generated by Dreamweaver CS3 .. its php! How do I check the SCRIPT_FILENAME please? mike mike...@gmail.com wrote in message news:bd9320b30812191502t2448ef31xa8ad8758f8638...@mail.gmail.com... first off - you must be coming from ASP for that code :P second - that error is usually due to the SCRIPT_FILENAME being incorrect. not the code in the script. On Fri, Dec 19, 2008 at 2:54 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Hi Philip, Here is my code ... ?php if (!function_exists(GetSQLValueString)) { function GetSQLValueString($theValue, $theType, $theDefinedValue = , $theNotDefinedValue = ) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists(mysql_real_escape_string) ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case text: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case long: case int: $theValue = ($theValue != ) ? intval($theValue) : NULL; break; case double: $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' : NULL; break; case date: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case defined: $theValue = ($theValue != ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rsSearch = -1; if (isset($_GET['product_name'])) { $colname_rsSearch = $_GET['product_name']; } mysql_select_db($database_MyDatabase, $MyDatabase); $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $MyDatabase) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? - Gary Philip Graham phi...@lightbox.org wrote in message news:200812191734.10664.phi...@lightbox.org... On December 19, 2008 17:20:32 Gary Maddock-Greene wrote: Hi, is it possible to de-bug a 'no input file specified' error. I get the error when trying to run my search script but do not know whats causing it. Is it a common error? What code/command/request is causing the error? PHP5 with MySQL adn IIS7 Thanks - Gary -- Philip Graham Lightbox Technologies Suite 312 240 Catherine St. Ottawa, ON, K2P 2G8 613-686-1661 ext. 102 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de-bug no input file specified
Hi Philip, Here is my code ... ?php if (!function_exists(GetSQLValueString)) { function GetSQLValueString($theValue, $theType, $theDefinedValue = , $theNotDefinedValue = ) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists(mysql_real_escape_string) ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case text: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case long: case int: $theValue = ($theValue != ) ? intval($theValue) : NULL; break; case double: $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' : NULL; break; case date: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case defined: $theValue = ($theValue != ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rsSearch = -1; if (isset($_GET['product_name'])) { $colname_rsSearch = $_GET['product_name']; } mysql_select_db($database_MyDatabase, $MyDatabase); $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $MyDatabase) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? - Gary It doesn't look like your code is the problem, how is the file being executed. Through the command line or IIS? In either case it sounds like either you have don't have permissions on the file, you're pointing at the wrong file or you've got a bad config setting somewhere. You can always try searching 'php no input file specified' and see if others before you have had the same problem for a quick fix. Other than that I'm sorry I can't be of more help but unfortunately I'm not at all familiar with PHP on windows/IIS. -- Philip Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de-bug no input file specified
yeah but it stinks of microsoft/vb/asp :) i can't really tell you in IIS, but that's the common reason nginx has a no input file specified - people ask about it all the time. On Fri, Dec 19, 2008 at 3:15 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: the code was generated by Dreamweaver CS3 .. its php! How do I check the SCRIPT_FILENAME please? mike mike...@gmail.com wrote in message news:bd9320b30812191502t2448ef31xa8ad8758f8638...@mail.gmail.com... first off - you must be coming from ASP for that code :P second - that error is usually due to the SCRIPT_FILENAME being incorrect. not the code in the script. On Fri, Dec 19, 2008 at 2:54 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Hi Philip, Here is my code ... ?php if (!function_exists(GetSQLValueString)) { function GetSQLValueString($theValue, $theType, $theDefinedValue = , $theNotDefinedValue = ) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists(mysql_real_escape_string) ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case text: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case long: case int: $theValue = ($theValue != ) ? intval($theValue) : NULL; break; case double: $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' : NULL; break; case date: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case defined: $theValue = ($theValue != ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rsSearch = -1; if (isset($_GET['product_name'])) { $colname_rsSearch = $_GET['product_name']; } mysql_select_db($database_MyDatabase, $MyDatabase); $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $MyDatabase) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? - Gary Philip Graham phi...@lightbox.org wrote in message news:200812191734.10664.phi...@lightbox.org... On December 19, 2008 17:20:32 Gary Maddock-Greene wrote: Hi, is it possible to de-bug a 'no input file specified' error. I get the error when trying to run my search script but do not know whats causing it. Is it a common error? What code/command/request is causing the error? PHP5 with MySQL adn IIS7 Thanks - Gary -- Philip Graham Lightbox Technologies Suite 312 240 Catherine St. Ottawa, ON, K2P 2G8 613-686-1661 ext. 102 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de-bug no input file specified
Thanks Philip i am running a search from a form (page 1) querying the db and returning the result on page 2 (well thats the theory) ! Philip Graham phi...@lightbox.org wrote in message news:200812191822.58155.phi...@lightbox.org... Hi Philip, Here is my code ... ?php if (!function_exists(GetSQLValueString)) { function GetSQLValueString($theValue, $theType, $theDefinedValue = , $theNotDefinedValue = ) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists(mysql_real_escape_string) ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case text: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case long: case int: $theValue = ($theValue != ) ? intval($theValue) : NULL; break; case double: $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' : NULL; break; case date: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case defined: $theValue = ($theValue != ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rsSearch = -1; if (isset($_GET['product_name'])) { $colname_rsSearch = $_GET['product_name']; } mysql_select_db($database_MyDatabase, $MyDatabase); $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $MyDatabase) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? - Gary It doesn't look like your code is the problem, how is the file being executed. Through the command line or IIS? In either case it sounds like either you have don't have permissions on the file, you're pointing at the wrong file or you've got a bad config setting somewhere. You can always try searching 'php no input file specified' and see if others before you have had the same problem for a quick fix. Other than that I'm sorry I can't be of more help but unfortunately I'm not at all familiar with PHP on windows/IIS. -- Philip Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] de-bug no input file specified
Hi Mike ... I think Adobe code does look like VB script actually ... I agree :) I wish I knew php better (so I didn't have to rely on crappy Dreamweaver code), I only started using it today and just want to script a simple search form on a 5 colomn products table ... not too hard eh? I have php installed, IIS7 running beautifully .. but can't get this simple form working. mike mike...@gmail.com wrote in message news:bd9320b30812191522w365dfd7cx5ca8829ab53f2...@mail.gmail.com... yeah but it stinks of microsoft/vb/asp :) i can't really tell you in IIS, but that's the common reason nginx has a no input file specified - people ask about it all the time. On Fri, Dec 19, 2008 at 3:15 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: the code was generated by Dreamweaver CS3 .. its php! How do I check the SCRIPT_FILENAME please? mike mike...@gmail.com wrote in message news:bd9320b30812191502t2448ef31xa8ad8758f8638...@mail.gmail.com... first off - you must be coming from ASP for that code :P second - that error is usually due to the SCRIPT_FILENAME being incorrect. not the code in the script. On Fri, Dec 19, 2008 at 2:54 PM, Gary Maddock-Greene g...@maddock-greene.co.uk wrote: Hi Philip, Here is my code ... ?php if (!function_exists(GetSQLValueString)) { function GetSQLValueString($theValue, $theType, $theDefinedValue = , $theNotDefinedValue = ) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists(mysql_real_escape_string) ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case text: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case long: case int: $theValue = ($theValue != ) ? intval($theValue) : NULL; break; case double: $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' : NULL; break; case date: $theValue = ($theValue != ) ? ' . $theValue . ' : NULL; break; case defined: $theValue = ($theValue != ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_rsSearch = -1; if (isset($_GET['product_name'])) { $colname_rsSearch = $_GET['product_name']; } mysql_select_db($database_MyDatabase, $MyDatabase); $query_rsSearch = sprintf(SELECT * FROM products WHERE product_name LIKE %s, GetSQLValueString(% . $colname_rsSearch . %, text)); $rsSearch = mysql_query($query_rsSearch, $MyDatabase) or die(mysql_error()); $row_rsSearch = mysql_fetch_assoc($rsSearch); $totalRows_rsSearch = mysql_num_rows($rsSearch); ? - Gary Philip Graham phi...@lightbox.org wrote in message news:200812191734.10664.phi...@lightbox.org... On December 19, 2008 17:20:32 Gary Maddock-Greene wrote: Hi, is it possible to de-bug a 'no input file specified' error. I get the error when trying to run my search script but do not know whats causing it. Is it a common error? What code/command/request is causing the error? PHP5 with MySQL adn IIS7 Thanks - Gary -- Philip Graham Lightbox Technologies Suite 312 240 Catherine St. Ottawa, ON, K2P 2G8 613-686-1661 ext. 102 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in array_key_exist?
Korgan a écrit : public function addXXX($id, $count) { $count = (int)$cout; Try to work with error_reporting set to E_ALL ;) session_start(); var_dump($_SESSION['XX']); /** A **/ If XX is a right value for a variable name, they are no problem. -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in array_key_exist?
Error reporting is set on E_ALL notice: it change value if I add the item which isnt in array Lupus Michaelis wrote: Korgan a écrit : public function addXXX($id, $count) { $count = (int)$cout; Try to work with error_reporting set to E_ALL ;) session_start(); var_dump($_SESSION['XX']); /** A **/ If XX is a right value for a variable name, they are no problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SimpleXML Bug question
On Tue, January 15, 2008 12:34 am, Naz Gassiep wrote: What's the current status on this bug: http://bugs.php.net/bug.php?id=39164 Regardless of what the PHP developers say in those comments, the modification of data when it is read is not correct. If it is intended behavior, then the developer/s who intend it to be that way are wrong. Under no circumstances can it be considered appropriate for any read operation to write anything. Some clarity on this matter would be great. The current status is closed as bogus. I dunno WHY they think it's bogus, but there it is. Perhaps if you emailed Helly and asked what his thinking was, and asked politely on php-internals for anybody to comment on why it should be that way, you'd get a better response. I don't use XML nor simpleXML enough to really comment, but at first glance, I'd have to say that the auto-creation of a node is pretty wrong. More research might make me change my mind... Suppose, for example, that the XML spec REQUIRES at least one valid node, and your XML is malformed without it. If that were the case, PHP forcing it to be valid by adding a dummy node seems perfectly reasonable. You may want to also consider submitting a patch if you really think it's wrong, and you've managed to find the commit that causes the problem. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SimpleXML Bug question
What's the current status on this bug: http://bugs.php.net/bug.php?id=39164 Regardless of what the PHP developers say in those comments, the modification of data when it is read is not correct. If it is intended behavior, then the developer/s who intend it to be that way are wrong. Under no circumstances can it be considered appropriate for any read operation to write anything. Some clarity on this matter would be great. Regards, - Naz. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in stream_socket_server()?
Would this class as a test? ?php $socket = stream_socket_server(tcp://0.0.0.0:8000, $errno, $errstr); if (!$socket) { echo $errstr ($errno)br /\n; } else { while (is_resource($conn = stream_socket_accept($socket, 30))) { while (is_resource($conn) $pkt = stream_get_line($conn, 100, \n)) { fwrite($conn, ''); sleep(10); echo $pkt; } } } ? I then sent 2*384kb loads per second through a terminal to it without problems, 10 minutes since i stopped writing data to it and it's still echoing out 1 line every 10 secs! Nathan René Fournier wrote: If you want a high speed socket server, use the low-level sockets instead (socket_create/bind/listen). The stream_socket_server version appears to have internal fixed 8k buffers that will overflow if you don't keep up by reading. This is a serious problem if you an application that reads the socket for messages and then, say, saves the result in a database. The delay while it is busy processing means you can't read the data in time unless you get involved in muti-threading. With the the low-level functions, the OS quietly buffers TCP/IP packets so there is no problem (tested on Windows XP Professional). ( http://php.oregonstate.edu/manual/en/function.stream-socket-server.php#67837 ) Has anyone confirmed this? I am doing tests with a stripped-down multi-client socket server, wonder if this issue is causing some of the problems I've seen. ...Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in == comparison?
Jeffrey Sambells wrote: OK I have a very strange bug: In the middle of my script I have these two lines: var_dump($test,$test2); echo '$test'=='$test2' is .($test==$test2); which is giving: int(0) string(6) Points '0'=='Points' is 1 I understand that PHP is loose typed and automatically does type conversion but in the many years I've been using PHP (mostly v4) the comparison had always converted to 'string' and in the case above returned FALSE, not TRUE. It seems here they are comparing as integers thus 'Points' evaluates to 0 and the comparison is TRUE. I tried comparing in the reverse sequence ($test2==$test) and the same occurred. It does work as expected if I have === but the rest of the scirpt isn't type sensitive so I want NULL, 0, and empty string to still maintain equality. Any ideas why this is suddenly happening? I'm using PHP 5.1, and I realize I could use other functions such as strval() in the comparison however I've used similar logic in the past without problems. Any help would be great. Thanks Jeff No, the opposite is true; strings are always converted to integers in such comparisons, as stated in TFM: http://www.php.net/manual/en/language.operators.comparison.php I'll quote it here: If you compare an integer with a string, the string is converted to a number. If you compare two numerical strings, they are compared as integers. These rules also apply to the switch statement. In your case, it's a bug in your code; you should be using === to also verify type, or casting $var1 to a string in your comparison. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in == comparison?
I tried comparing in the reverse sequence ($test2==$test) and the same occurred. It does work as expected if I have === but the rest of the scirpt isn't type sensitive so I want NULL, 0, and empty string to still maintain equality. Wups, I missed the last part there. You want the empty() function: http://www.php.net/manual/en/function.empty.php It can do exactly what you want. Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in == comparison?
Jeffrey Sambells wrote: hrm.. It just seemed strange as the script I was working on is 3 years old and had worked flawlessly until today. Thanks. - Jeff ~~ Jeffrey Sambells Director of Research and Development Zend Certified Engineer (ZCE) We-Create Inc. [EMAIL PROTECTED] email 519.745.7374 x103 office 519.897.2552 mobile ~~ Get Mozilla Firefox at http://spreadfirefox.com On 21-Jul-06, at 12:45 PM, Adam Zey wrote: Jeffrey Sambells wrote: OK I have a very strange bug: In the middle of my script I have these two lines: var_dump($test,$test2); echo '$test'=='$test2' is .($test==$test2); which is giving: int(0) string(6) Points '0'=='Points' is 1 I understand that PHP is loose typed and automatically does type conversion but in the many years I've been using PHP (mostly v4) the comparison had always converted to 'string' and in the case above returned FALSE, not TRUE. It seems here they are comparing as integers thus 'Points' evaluates to 0 and the comparison is TRUE. I tried comparing in the reverse sequence ($test2==$test) and the same occurred. It does work as expected if I have === but the rest of the scirpt isn't type sensitive so I want NULL, 0, and empty string to still maintain equality. Any ideas why this is suddenly happening? I'm using PHP 5.1, and I realize I could use other functions such as strval() in the comparison however I've used similar logic in the past without problems. Any help would be great. Thanks Jeff No, the opposite is true; strings are always converted to integers in such comparisons, as stated in TFM: http://www.php.net/manual/en/language.operators.comparison.php I'll quote it here: If you compare an integer with a string, the string is converted to a number. If you compare two numerical strings, they are compared as integers. These rules also apply to the switch statement. In your case, it's a bug in your code; you should be using === to also verify type, or casting $var1 to a string in your comparison. Regards, Adam Zey. Since my other reply might have been overlooked as a double-reply, it bears repeating here; the empty() function is designed to do what you want (check empty strings, int(0), null, etc). Regards, Adam. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in == comparison?
hrm.. It just seemed strange as the script I was working on is 3 years old and had worked flawlessly until today. Thanks. - Jeff ~~ Jeffrey Sambells Director of Research and Development Zend Certified Engineer (ZCE) We-Create Inc. [EMAIL PROTECTED] email 519.745.7374 x103 office 519.897.2552 mobile ~~ Get Mozilla Firefox at http://spreadfirefox.com On 21-Jul-06, at 12:45 PM, Adam Zey wrote: Jeffrey Sambells wrote: OK I have a very strange bug: In the middle of my script I have these two lines: var_dump($test,$test2); echo '$test'=='$test2' is .($test==$test2); which is giving: int(0) string(6) Points '0'=='Points' is 1 I understand that PHP is loose typed and automatically does type conversion but in the many years I've been using PHP (mostly v4) the comparison had always converted to 'string' and in the case above returned FALSE, not TRUE. It seems here they are comparing as integers thus 'Points' evaluates to 0 and the comparison is TRUE. I tried comparing in the reverse sequence ($test2==$test) and the same occurred. It does work as expected if I have === but the rest of the scirpt isn't type sensitive so I want NULL, 0, and empty string to still maintain equality. Any ideas why this is suddenly happening? I'm using PHP 5.1, and I realize I could use other functions such as strval() in the comparison however I've used similar logic in the past without problems. Any help would be great. Thanks Jeff No, the opposite is true; strings are always converted to integers in such comparisons, as stated in TFM: http://www.php.net/manual/en/language.operators.comparison.php I'll quote it here: If you compare an integer with a string, the string is converted to a number. If you compare two numerical strings, they are compared as integers. These rules also apply to the switch statement. In your case, it's a bug in your code; you should be using === to also verify type, or casting $var1 to a string in your comparison. Regards, Adam Zey. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Bug Tracking
Can anyone point me in the direction where I can find a place to download the bug track system that PHP/PEAR PECL uses. I seem to remember it is available but can't find it anymore! Ta! Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Bug Tracking
This one? http://dev.mysql.com/downloads/other/eventum/ On 7/6/06, Chris Hemmings [EMAIL PROTECTED] wrote: Can anyone point me in the direction where I can find a place to download the bug track system that PHP/PEAR PECL uses. I seem to remember it is available but can't find it anymore! Ta! Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Bug Tracking
Dan McCullough wrote: This one? http://dev.mysql.com/downloads/other/eventum/ On 7/6/06, Chris Hemmings [EMAIL PROTECTED] wrote: Can anyone point me in the direction where I can find a place to download the bug track system that PHP/PEAR PECL uses. I seem to remember it is available but can't find it anymore! Ta! Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Cheers Dan, Looks like the one :-) http://www.mysqltalk.org/what-software-is-used-by-bugsmysqlcom-vt10767.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Bug Tracking
I just installed it so its fresh in my mind. :) On 7/6/06, Chris Hemmings [EMAIL PROTECTED] wrote: Dan McCullough wrote: This one? http://dev.mysql.com/downloads/other/eventum/ On 7/6/06, Chris Hemmings [EMAIL PROTECTED] wrote: Can anyone point me in the direction where I can find a place to download the bug track system that PHP/PEAR PECL uses. I seem to remember it is available but can't find it anymore! Ta! Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Cheers Dan, Looks like the one :-) http://www.mysqltalk.org/what-software-is-used-by-bugsmysqlcom-vt10767.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug in XMLWriter?
Expected behavior. See comments within code snippet. D. Dante Lorenso wrote: I am using XMLWriter with PHP 5.1.4 and find that it doesn't behave as I expect. I am under the impressing that until I call 'endElement', I should be free to continue adding attributes to an opened element regardless of whether I have already added elements or text below it. Look at this sample code: ?php //-- // create an object to write to an in-memory buffer $XML = new XMLWriter(); $XML-openMemory(); // start new element and add 1 attribute $XML-startElement(a); $XML-writeAttribute(href, http://www.google.com;); // add a text node $XML-text(Google); Here you just closed the starting element tag and moved into content. // add another attribute (DOES NOT WORK) $XML-writeAttribute(target, _blank); If you check the return value (FALSE), you will see it failed. The writer is positioned within element content so cannot write an attribute. Attributes must be written while still positioned within the element's start tag. Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bug in XMLWriter?
Rob Richards wrote: Expected behavior. See comments within code snippet. D. Dante Lorenso wrote: I am using XMLWriter with PHP 5.1.4 and find that it doesn't behave as I expect. I am under the impressing that until I call 'endElement', I should be free to continue adding attributes to an opened element regardless of whether I have already added elements or text below it. Look at this sample code: ?php //-- // create an object to write to an in-memory buffer $XML = new XMLWriter(); $XML-openMemory(); // start new element and add 1 attribute $XML-startElement(a); $XML-writeAttribute(href, http://www.google.com;); // add a text node $XML-text(Google); Here you just closed the starting element tag and moved into content. So adding a text node closes the starting tag? That shouldn't happen. Seems to me that this is non-intuitive. I would expect that until I call 'endElement' that the node is still constructible. Internally it should work something like DOM where the node is not 'serialized' to xml tag form until the endElement is called. That way, attributes could still be defined even after 'text' nodes were appended. // add another attribute (DOES NOT WORK) $XML-writeAttribute(target, _blank); If you check the return value (FALSE), you will see it failed. The writer is positioned within element content so cannot write an attribute. Attributes must be written while still positioned within the element's start tag. If you look at XML as a tree, despite delving deeper into the tree (adding text node), as I walk back up, I should be positioned back on the element I opened with 'startElement'. Turning the node into a string should not occur until the leaf nodes are closed. I understand slightly more memory will be consumed the way I define it, but the object would certainly be more useful. In the way I extend XMLWriter, I have a method like this: ?php class A extends XMLWriter { ... // public function push() { $args = func_get_args(); // create new node $this-startElement(array_shift($args)); // we have a text node if (count($args) % 2) { $this-text(array_pop($args)); } // add attributes for ($i = 0; $i count($args); $i += 2) { $this-attr($args[$i], $args[$i +1]); } } // ... } ? The way this works is as follows: * first argument is the tag name * last argument (if present and even number of arguments) is the text value inside the node * middle arguments are attribute = attribute_value pairs of 2 After this node is created, I still want to use $X-attr() to set more attributes. ?php $X = new A(); $X-push(a, href, http://www.php.net;, Click Here); if ($want_new_window) { $X-attr(target, _blank); } print $X-to_string(); ? I have an object like this already written on top of DOM, but found XMLWriter to be more attractive because of better memory utilization. But still, 'endElement' doesn't do what it sounds like it does if the element is closed long before it gets called. Is it possible to change this behavior? Dante -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bug in XMLWriter?
D. Dante Lorenso wrote: Rob Richards wrote: Expected behavior. See comments within code snippet. D. Dante Lorenso wrote: I am using XMLWriter with PHP 5.1.4 and find that it doesn't behave as I expect. I am under the impressing that until I call 'endElement', I should be free to continue adding attributes to an opened element regardless of whether I have already added elements or text below it. Look at this sample code: ?php //-- // create an object to write to an in-memory buffer $XML = new XMLWriter(); $XML-openMemory(); // start new element and add 1 attribute $XML-startElement(a); $XML-writeAttribute(href, http://www.google.com;); // add a text node $XML-text(Google); Here you just closed the starting element tag and moved into content. So adding a text node closes the starting tag? That shouldn't happen. Uhm, so where's the text supposed to go? Seems to me that this is non-intuitive. I would expect that until I call 'endElement' that the node is still constructible. Internally it should work something like DOM where the node is not 'serialized' to xml tag form until the endElement is called. That way, attributes could still be defined even after 'text' nodes were appended. You are missing the point of xmlWriter. It should happen. It provides a forward only, non-cached means of writing to a stream. There are no nodes or trees here. Calling endElement simply instructs the writer to close any open content or attributes and finally the currently opened element. For your example code, just write all attributes prior to adding any element content; otherwise you really want a tree based API like DOM or SimpleXML where you can move backwards. In any case, the behavior will not change. The behavior is defined in the XMLTextWriter class in C#, from which XMLWriter is based on. Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] possible bug in date()
I'm trying to create a date with the DATE_W3C or DATE_ATOM format (they are the same format according to the examples), but the output of date doesn't match the example in the documentation. The http://us3.php.net/manual/en/ref.datetime.php page says the formats are as follows: DATE_ATOM (string) Atom (example: 2005-08-15T15:52:01+00:00) DATE_W3C (string) World Wide Web Consortium (example: 2005-08-15T15:52:01+00:00) DATE_ISO8601 (string) ISO-8601 (example: 2005-08-15T15:52:01+) If I create a date with this code: $this-dateCreated = date( DATE_ATOM, mktime( 0, 0, 0, 23, 2, 2006 ) ); echo $this-dateCreated; I expect to see: 2006-02-23T00:00:00-08:00 The output I actually get is the ISO-8601 format: 2006-02-23T00:00:00-0800 The only difference is the colon in the GMT offset at the end. Is the example output in the web page wrong? Or is this a bug in PHP? Thanks, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strtodate() bug?
Hello, I've got some weird behavior using PHP 4.3.9. I use the function of strtotime(last Sunday); and it's returning the timestamp for last Saturday. However, if I use strtotime(-1 day); (I'm running this program on a Monday) it returns the correct timestamp for Sunday. Is this a bug in PHP 4.3.9? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strtodate() bug?
I've got some weird behavior using PHP 4.3.9. I use the function of strtotime(last Sunday); and it's returning the timestamp for last Saturday. However, if I use strtotime(-1 day); (I'm running this program on a Monday) it returns the correct timestamp for Sunday. Is this a bug in PHP 4.3.9? Probably. 5.1.2 says: $x = strtotime(last Sunday); print ( date('r', $x) ); Sun, 02 Apr 2006 00:00:00 -0800 4.3.9 is *really* old. -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/Oracle : bug with accent...
David BERCOT wrote: Hi, I have a big problem with my Debian server (Apache 2, PHP 5, Oracle Instant Client). I've modified the environment variable NLS_LANG and, with SQL*Plus, everything is ok ! But, in a PHP page, I can't insert a value with accent (ex: Irène). I can read data with accent, but not inserting !!! I searched all the afternoon, testing many solutions, without success. I think I'm not alone with this problem but... Do you have any clue ? Something to look at ? Try looking at the multi-byte string functions. Not sure if that would help you or not though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/Oracle : bug with accent...
I have a big problem with my Debian server (Apache 2, PHP 5, Oracle Instant Client). I've modified the environment variable NLS_LANG and, with SQL*Plus, everything is ok ! But, in a PHP page, I can't insert a value with accent (ex: Irène). I can read data with accent, but not inserting !!! I searched all the afternoon, testing many solutions, without success. I think I'm not alone with this problem but... Do you have any clue ? Something to look at ? Try looking at the multi-byte string functions. Not sure if that would help you or not though. OK. I've finally found the solution. Everything was ok except the Apache environment variables (NLS_LANG). Now, it works... Thank you. David. signature.asc Description: Ceci est une partie de message numériquement signée
[PHP] PHP/Oracle : bug with accent...
Hi, I have a big problem with my Debian server (Apache 2, PHP 5, Oracle Instant Client). I've modified the environment variable NLS_LANG and, with SQL*Plus, everything is ok ! But, in a PHP page, I can't insert a value with accent (ex: Irène). I can read data with accent, but not inserting !!! I searched all the afternoon, testing many solutions, without success. I think I'm not alone with this problem but... Do you have any clue ? Something to look at ? Thank you very much. David. signature.asc Description: Ceci est une partie de message numériquement signée
Re: [PHP] Serious bug ?
Marco Kaiser wrote: Hi, i tested it with php 5.1.3-dev snap and it works correctly for me. btw. $return = $notdefined_variable; is a bad style for coding and this happens in your situation in a undefined behavior. If you think this is a bug please go to http://bugs.php.net and report them there. I checked on bugs.php.net and apparently it was resolved meanwhile (I was testing it on server with older PHP), and they don't take bug reports on previous versions. I should have checked before posting here, my bad :) Btw, I agree, bad style, but I like doing this: $id = max(0, (int)@$_GET['id']); a lot more than writing isset() ? : -- Open source PHP code generator for DB operations http://sourceforge.net/projects/bfrcg/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Serious bug ?
Hi, i tested it with php 5.1.3-dev snap and it works correctly for me. btw. $return = $notdefined_variable; is a bad style for coding and this happens in your situation in a undefined behavior. If you think this is a bug please go to http://bugs.php.net and report them there. 2006/2/4, Bogdan Ribic [EMAIL PROTECTED]: Hi all, I've found a strange bug with extract($GLOBALS, EXTR_REFS), and it only shows up if you try to access a non-existent variable or array member before that. Here's a demo script: // Uncomment this line to see the problem // $return = @$_GET['xx']; function extr_globals() { extract($GLOBALS, EXTR_REFS); }; function test($msg) { $x = 'OK'; $msg = 'wrong'; return $x; }; echo test('login') . \n; extr_globals(); echo test('login'); If you run this script, it will output two OKs, as it should. If you however uncomment the first line, one with $_GET assignment, it will output an OK and then text wrong. Tested with php 4.3.10 and 5.0.3 on a windows machine. What actually happens is that extract($GLOBALS, EXTR_REFS) really messes up nametables. If you step into test function with debugger, you will see that all variables inside the function will already be initialized to the value of the parameter $msg, and assigning to one var will overwrite values in unrelated variables. I repeat, this only happens if you tried to access non-existent var or array member before that. So it's a bug. Do I get a PHP T-shirt ? :-) Boban. -- Open source PHP code generator for DB operations http://sourceforge.net/projects/bfrcg/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Marco Kaiser
[PHP] Serious bug ?
Hi all, I've found a strange bug with extract($GLOBALS, EXTR_REFS), and it only shows up if you try to access a non-existent variable or array member before that. Here's a demo script: // Uncomment this line to see the problem // $return = @$_GET['xx']; function extr_globals() { extract($GLOBALS, EXTR_REFS); }; function test($msg) { $x = 'OK'; $msg = 'wrong'; return $x; }; echo test('login') . \n; extr_globals(); echo test('login'); If you run this script, it will output two OKs, as it should. If you however uncomment the first line, one with $_GET assignment, it will output an OK and then text wrong. Tested with php 4.3.10 and 5.0.3 on a windows machine. What actually happens is that extract($GLOBALS, EXTR_REFS) really messes up nametables. If you step into test function with debugger, you will see that all variables inside the function will already be initialized to the value of the parameter $msg, and assigning to one var will overwrite values in unrelated variables. I repeat, this only happens if you tried to access non-existent var or array member before that. So it's a bug. Do I get a PHP T-shirt ? :-) Boban. -- Open source PHP code generator for DB operations http://sourceforge.net/projects/bfrcg/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Schroedinger's Bug - may require exorcism...
What to do next? I'd check to see if your page is being inadvertantly called twice (I've seen this happen when people used frames.. or like someone else mentioned, doing a double include() or sometimes redirecting back to itself via header())... anything that could possibly re-initiate the page, check into. Failing that, do it old school... just inserted die() statements to break execution at various points and see where the probably first starts occuring and focus in that area. Crude but it works. At least helps narrow down where the problem could be. It doesn't do something silly like include() itself inside a conditional somewhere does it? You might also echo/var_dump/print_r/whatever some of your key variables (especially input variables like $_GET/$_POST/etc and variables used in conditionals) and try to isolate what combination causes your problem. Since it doesn't do it all the time, I'd guess you could have something like: $x = 4; if ($x 1) { include('someinclude.inc'); } if ($x 5) { include('someinclude.inc'); } Where 'someinclude.inc' contains your double declarations. Next point... check your logic around your include()/require()s and such. Maybe you have a condition where something is falling into multiple categories. The logic puzzle is as much about writing good logic as untangling possibly flawed logic. If all else fails, trace through your code by hand... interpret it in your head like the computer would.. like by line.. maybe you'll see where something is ambiguous and under certain conditions creates a fail. Let us know what you find.. kind of curious myself. -TG = = = Original message = = = So... I have this script (being called in a perfectly typical way by PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs perfectly, and sometimes chooses, totally haphazardly, to seemingly run itself twice, which of course causes it to die with a fatal error after it tries to redefine some functions. As mysterious as that is, it turns out it must be something altogether more sinister. I tried putting die() at the end of the script, on the assumption that it was for some reason executing twice, yet behold: the problem is still present, and the PHP error log still complains about constants and functions being redefined! The problem, I therefore thought, cannot be that the script is being run twice. (In retrospect, this was the most likely possibility, because the page doesn't actually output anything if it dies with this error.) So for debugging, I added a bit that logs one message to a file immediately before the die() at the end of the file, and a different message after the die(). The die() seems to be working normally, in that it only logs the first message... But wait a second! WTF? If the PHP error log is to be believed, then the script should be dying with a fatal error before it even *gets* to that point in the script, isn't it? And the greater WTF is the fact that, as I mentioned above, every time the page is requested, it unpredictably either does this or works flawlessly. Oh my. How do I even *begin* to debug something like this? Thanks for any help. -- Adam Atlas ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Schroedinger's Bug - may require exorcism...
On Wed, 2005-11-30 at 11:48, [EMAIL PROTECTED] wrote: What to do next? I'd check to see if your page is being inadvertantly called twice (I've seen this happen when people used frames.. or like someone else mentioned, doing a double include() or sometimes redirecting back to itself via header())... anything that could possibly re-initiate the page, check into. Failing that, do it old school... just inserted die() statements to break execution at various points and see where the probably first starts occuring and focus in that area. Crude but it works. At least helps narrow down where the problem could be. It doesn't do something silly like include() itself inside a conditional somewhere does it? You might also echo/var_dump/print_r/whatever some of your key variables (especially input variables like $_GET/$_POST/etc and variables used in conditionals) and try to isolate what combination causes your problem. Since it doesn't do it all the time, I'd guess you could have something like: $x = 4; if ($x 1) { include('someinclude.inc'); } if ($x 5) { include('someinclude.inc'); } Which reminds me... make sure your using include() where appropriate, and include_once() where appropriate. Obviously include_once() should ALWAYS be used when the source contains function or class definitions. 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. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Schroedinger's Bug - may require exorcism...
So... I have this script (being called in a perfectly typical way by PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs perfectly, and sometimes chooses, totally haphazardly, to seemingly run itself twice, which of course causes it to die with a fatal error after it tries to redefine some functions. As mysterious as that is, it turns out it must be something altogether more sinister. I tried putting die() at the end of the script, on the assumption that it was for some reason executing twice, yet behold: the problem is still present, and the PHP error log still complains about constants and functions being redefined! The problem, I therefore thought, cannot be that the script is being run twice. (In retrospect, this was the most likely possibility, because the page doesn't actually output anything if it dies with this error.) So for debugging, I added a bit that logs one message to a file immediately before the die() at the end of the file, and a different message after the die(). The die() seems to be working normally, in that it only logs the first message... But wait a second! WTF? If the PHP error log is to be believed, then the script should be dying with a fatal error before it even *gets* to that point in the script, isn't it? And the greater WTF is the fact that, as I mentioned above, every time the page is requested, it unpredictably either does this or works flawlessly. Oh my. How do I even *begin* to debug something like this? Thanks for any help. -- Adam Atlas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Schroedinger's Bug - may require exorcism...
On Tue, 2005-11-29 at 19:22, Adam Atlas wrote: So... I have this script (being called in a perfectly typical way by PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs perfectly, and sometimes chooses, totally haphazardly, to seemingly run itself twice, which of course causes it to die with a fatal error after it tries to redefine some functions. As mysterious as that is, it turns out it must be something altogether more sinister. I tried putting die() at the end of the script, on the assumption that it was for some reason executing twice, yet behold: the problem is still present, and the PHP error log still complains about constants and functions being redefined! The problem, I therefore thought, cannot be that the script is being run twice. (In retrospect, this was the most likely possibility, because the page doesn't actually output anything if it dies with this error.) So for debugging, I added a bit that logs one message to a file immediately before the die() at the end of the file, and a different message after the die(). The die() seems to be working normally, in that it only logs the first message... But wait a second! WTF? If the PHP error log is to be believed, then the script should be dying with a fatal error before it even *gets* to that point in the script, isn't it? And the greater WTF is the fact that, as I mentioned above, every time the page is requested, it unpredictably either does this or works flawlessly. Oh my. How do I even *begin* to debug something like this? I think you mean heisenbug... http://en.wikipedia.org/wiki/Heisenbug http://en.wikipedia.org/wiki/Schr%C3%B6dinger%27s_cat Do a grep for dynamic includes of the file script in question. Alternatively do a grep for files that dynamically include the script in question. Work your way to the root. 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. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Schroedinger's Bug - may require exorcism...
On Tue, 2005-11-29 at 19:42, Robert Cummings wrote: On Tue, 2005-11-29 at 19:22, Adam Atlas wrote: So... I have this script (being called in a perfectly typical way by PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs perfectly, and sometimes chooses, totally haphazardly, to seemingly run itself twice, which of course causes it to die with a fatal error after it tries to redefine some functions. As mysterious as that is, it turns out it must be something altogether more sinister. I tried putting die() at the end of the script, on the assumption that it was for some reason executing twice, yet behold: the problem is still present, and the PHP error log still complains about constants and functions being redefined! The problem, I therefore thought, cannot be that the script is being run twice. (In retrospect, this was the most likely possibility, because the page doesn't actually output anything if it dies with this error.) So for debugging, I added a bit that logs one message to a file immediately before the die() at the end of the file, and a different message after the die(). The die() seems to be working normally, in that it only logs the first message... But wait a second! WTF? If the PHP error log is to be believed, then the script should be dying with a fatal error before it even *gets* to that point in the script, isn't it? And the greater WTF is the fact that, as I mentioned above, every time the page is requested, it unpredictably either does this or works flawlessly. Oh my. How do I even *begin* to debug something like this? I think you mean heisenbug... http://en.wikipedia.org/wiki/Heisenbug http://en.wikipedia.org/wiki/Schr%C3%B6dinger%27s_cat Hmmm, you learn something new every day: http://en.wikipedia.org/wiki/Schroedinbug But the problem you're having seems better represented as a heisenbug :) 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. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Possible bug with imagettftext and imageft text when imagealphablending is false
I have been attempting to write a dynamic text replacement script that would generate transparent PNGs using gd, and it works fine except when one of the characters in a font has parts of it that overhang into the previous characters. You can see what I mean in this test script: ?php $img = imagecreatetruecolor(200, 200); imagealphablending($img, false); $trans = imagecolortransparent($img); imagefilledrectangle($img, 0, 0, 400, 400, $trans); $green = imagecolorallocate($img, 6, 68, 0); imagettftext($img, 30, 0, 10, 50, $green, carolingia.ttf, Linux); header(Content-type: image/png); imagesavealpha($img, true); imagepng($img); imagedestroy($img); ? The result can be seen at http://ethilien.net/tests/text.php When you compare the text with what it should look like when I comment out the imagealphablending($img, false); line here http://ethilien.net/tests/text2.php you can see that the end of the 'u' is cut off. I think that this is because the lower-left slash of the 'x' overlaps it and causes it to be overwritten. This might be a bug in GD and not PHP, but I wanted to see if anyone has encountered this problem before or if I'm just not doing something right. Thanks, -Connor McKay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Possible bug in array_diff() php v4.4.0 or at least some odd behavior
I have two arrays: $faqDataPost: array 1 = array 'faq_order' = '1' 'faq_question' = 'What is the air speed of a fully laden swallow?' 'show_question' = '1' 'faq_answer' = 'African or European?' 3 = array 'faq_order' = '2' 'faq_question' = 'Where is our shrubbery?' 'show_question' = '1' 'faq_answer' = 'Nee! Nee!' 4 = array 'faq_order' = '3' 'faq_question' = 'Where is Lancelot?' 'show_question' = '1' 'faq_answer' = 'We eat and drink and dance a lot.' $faqDataDB: array 1 = array 'faq_data_id' = '1' 'faq_question' = 'What is the air speed of a fully laden swallow?' 'faq_answer' = 'African or European?' 'faq_order' = '1' 'show_question' = '0' 3 = array 'faq_data_id' = '3' 'faq_question' = 'Where is our shrubbery?' 'faq_answer' = 'Nee! Nee!' 'faq_order' = '2' 'show_question' = '0' 4 = array 'faq_data_id' = '4' 'faq_question' = 'Where is Lancelot?' 'faq_answer' = 'We eat and drink and dance a lot.' 'faq_order' = '3' 'show_question' = '0' // and this code(sorry the wrap is a bit off): print'br /$faqDataPost:br /';var_dump($faqDataPost); print'br /$faqDataDB:br /';var_dump($faqDataDB); // Get the changed data... // foreach($faqDataPost as $key = $r) { unset($faqDataDB[$key]['faq_data_id']); $r['show_question'] = isset($r['show_question']) ? $r['show_question'] : 0; print'br /$rbr /';var_dump($r); print'br /DBbr /';var_dump($faqDataDB[$key]); if((string)$r['show_question'] !== (string)$faqDataDB[$key]['show_question']) { print br /Does Not Match. Should show up in diff/br /; } $faqDataInsert[$key] = array_diff($r, $faqDataDB[$key]); print'br /diffbr/pre';print_r($faqDataInsert[$key]);print'/pre'; } // and these results: $r array 'faq_order' = '1' 'faq_question' = 'What is the air speed of a fully laiden swallow?' 'show_question' = '1' 'faq_answer' = 'African or European?' DB array 'faq_question' = 'What is the air speed of a fully laiden swallow?' 'faq_answer' = 'African or European?' 'faq_order' = '1' 'show_question' = '0' Does Not Match. Should show up in diff diff Array ( ) $r array 'faq_order' = '2' 'faq_question' = 'Where is our shrubbery?' 'show_question' = '1' 'faq_answer' = 'Nee! Nee!' DB array 'faq_question' = 'Where is our shrubbery?' 'faq_answer' = 'Nee! Nee!' 'faq_order' = '2' 'show_question' = '0' Does Not Match. Should show up in diff diff Array ( [show_question] = 1 ) $r array 'faq_order' = '3' 'faq_question' = 'Where is Lancealot?' 'show_question' = '1' 'faq_answer' = 'We eat and drink and dance a lot.' DB array 'faq_question' = 'Where is Lancealot?' 'faq_answer' = 'We eat and drink and dance a lot.' 'faq_order' = '3' 'show_question' = '0' Does Not Match. Should show up in diff diff Array ( [show_question] = 1 ) /**/ The problem is that in the first loop through the arrays, array_diff() doesn't pick up that ['show_question'] is different, although it does pick it up in the following loops. The interesting bit is that arra_diff_assoc() DOES pick up the difference in the first loop. Both arrays are built in foreach() statements and I can't see any difference between the first sub array and subsequent sub arrays that would cause array_diff() to miss the diference in the first one. If I change any of the other values in the first sub array, array_diff() will pick those up fine, just not the ['show_question'] part. I'm going to use array_diff_assoc(0 for this right now because it works and that what matters, but does anyone know why I'm having this problem with array_diff()? Can you see something that I'm missing? Thanks! Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] possible bug (string equality to zero)?
Is it a bug that ($var == 0) is always true for any string $var? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] possible bug (string equality to zero)?
[snip] Is it a bug that ($var == 0) is always true for any string $var? [/snip] You are comparing a string to an integer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible bug (string equality to zero)?
No, Christopher, that is not a bug. As long as the var is empty, and if you try to compare with 0, or false, it will report true in the comparison because the variable does not contain anything, which will mean false for a boolean and 0 for a variable. If you are attempting to discover if a string contains data, use empty() instead. You can also check if the string is null or actual zero (0). Regards, Torgny Christopher J. Bottaro wrote: Is it a bug that ($var == 0) is always true for any string $var? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible bug (string equality to zero)?
[snip] Is it a bug that ($var == 0) is always true for any string $var? [/snip] You are comparing a string to an integer. Right. This is clearly documented at http://www.php.net/operators.comparison -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible bug (string equality to zero)?
Christopher J. Bottaro wrote: Is it a bug that ($var == 0) is always true for any string $var? For any string? How about the string 5? :-) PHP tries to help you out, but there's not much it can do when you ask it to compare a string like 'foo' to an integer. It scans your string from left to right and uses the leading numbers to create the integer. For example, 53chris is 53, but chris53 is 0 (no leading numbers). Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible bug (string equality to zero)?
Hi, Is it a bug that ($var == 0) is always true for any string $var? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Check this out! http://us3.php.net/manual/en/types.comparisons.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A bug with RecursiveIteratorIterator?
I'm trying to extend the RecursiveIteratorIterator class, to limit which children it recurses through. The documentation here: http://www.php.net/~helly/php/ext/spl/classRecursiveIteratorIterator.html says that there is a ahapublic method callHasChildren(), which I figured was a good place to start. It seemed like it made sense, except for the fact that that callHasChildren() does not exist. Overloading the function does nothing, and instantiating my extended object, then manually calling callHasChildren() results in a method not found error. Call to undefined method RecursiveIteratorIterator::callhaschildren() I'm including my complete extension class below Thanks, Chris class CPage_TreeMenuIterator extends RecursiveIteratorIterator { function __construct(CPage_Node $it) { parent::__construct($it,RIT_SELF_FIRST); } function callHasChildren() { echo CPage_TreeMenuIterator::callHasChildren();br /\n; return parent::callHasChildren(); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A bug with RecursiveIteratorIterator?
In further looking at the SPL classes, I'm thinking I want to use the RecursiveFilterIterator class to filter my nodes. But I ran into another problem: the class RecursiveFilterIterator does not exist. Am I missing something here? Confused, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A bug with RecursiveIteratorIterator?
Chris wrote: In further looking at the SPL classes, I'm thinking I want to use the RecursiveFilterIterator class to filter my nodes. But I ran into another problem: the class RecursiveFilterIterator does not exist. Am I missing something here? your out on the bleeding edge so to speak - not many people have played with this stuff yet - alot will depend on the php build your using - best bet is to try the latest RC of 5.1 and see what that has in it I have a felling you will have to make a bit of use of the following funcs (and maybe even the reflection API) to figure out _exactly_ what is available in your build: http://php.net/manual/en/function.get-declared-classes.php http://php.net/manual/en/function.get-declared-interfaces.php http://php.net/manual/en/function.get-class-methods.php Confused, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A bug with RecursiveIteratorIterator?
Jochem Maas wrote: Chris wrote: In further looking at the SPL classes, I'm thinking I want to use the RecursiveFilterIterator class to filter my nodes. But I ran into another problem: the class RecursiveFilterIterator does not exist. Am I missing something here? your out on the bleeding edge so to speak - not many people have played with this stuff yet - alot will depend on the php build your using - best bet is to try the latest RC of 5.1 and see what that has in it I have a felling you will have to make a bit of use of the following funcs (and maybe even the reflection API) to figure out _exactly_ what is available in your build: http://php.net/manual/en/function.get-declared-classes.php http://php.net/manual/en/function.get-declared-interfaces.php http://php.net/manual/en/function.get-class-methods.php Thanks for the response. I'm really in love with most of the SPL stuff, it's most unfortunate that some parts aren't ready yet. Upgrading would be OK for my test server, but I was hoping to put this code on a PHP 5.0.3 server (upgrading there is an option, but a very undesirable one). I'll look into precisely what is working on my 5.0.3 development server at the moment. Any ideas if this functionality is likely to change? Right now I'm specifically looking the Iterator and RecursiveIterator stuff. I'll explain my precise situation in more detail in the hopes that someone can make some suggestions or point out another way I might be able to do this without filtering the RecursiveIterator. I'm essentially storing the navigation of a Website in an object tree. The root node (Home) has children, each of those has children, etc. My tree definition file (an include that uses method calls to the CPage object) creates the tree, and assigns different target areas for the navigation to appear in. So one CPage_Node might reside in the Top target, but send it's children to the Left target. and One of those children might Send *it's* children to the Tab target, while the rest jsut send theirs to the Left target. So, for each target that is a Tree (displays a tree structure) I Recursively Iterate the Full page tree, starting at the Root Node point, but I have to stop displaying children that are being shown in another target. I can get it to work with the follwing code (using the RecursiveIterator, but not the RecursiveFilterIterator) $iTarget = $oPage-GetMenu(CPAGE_TARGET_LEFT)-GetTarget(); foreach($oPage-GetMenu(CPAGE_TARGET_LEFT)-GetRecursiveNodes() as $oNode) { if($oNode-GetTarget() != $iTarget) continue; // Display the node here echo str_repeat(' ',$oNode-GetLevel()),$oNode-GetName(),\n; } Thanks, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A Bug in string 'brbr eD'?
I found this quite weired problem when I was trying to generate a mysql query string, something like WHERE TheDateDATA_ADD(..) The query string returns something like WHERE TheDate Withought the left part. You can actually try to use this to verify the problem: echo 'brbr eD'; What you get? I got D Quite confusing. Anyone think this is a bug or something I missed? -- If you have a minute, please visit http://www.cchere.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A Bug in string 'brbr eD'?
El Dom 26 Jun 2005 17:31, cchereTieShou escribió: I found this quite weired problem when I was trying to generate a mysql query string, something like WHERE TheDateDATA_ADD(..) The query string returns something like WHERE TheDate Withought the left part. You can actually try to use this to verify the problem: echo 'brbr eD'; What you get? I got D Quite confusing. Anyone think this is a bug or something I missed? Uhhmm??? [EMAIL PROTECTED] ~]$ echo ?php echo 'brbr eD'; ? | php Content-type: text/html; charset=iso-8859-1 X-Powered-By: PHP/4.3.11 brbr eD -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Bug/Error with XML Parsing Syntax??
I'm not sure what's wrong with PHP.. I ran the XML file through the Mozilla and it validate just fine. I get XML parse error but it gave no reason for the errors. The source code here is [code] $data = MessageWere changing/Message; $xml_parser = xml_parser_create('ISO-8859-1'); xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($xml_parser, trim($data), $vals, $index); if (xml_error_string($xml_parser)) { echo br; echo XML error in given source on br; echo Line: .xml_get_current_line_number($xml_parser).br; echo Column: .xml_get_current_column_number($xml_parser).br; echo Reason: .xml_error_string(xml_get_error_code($xml_parser)).br; echo br; echo XML Data: .$data; echo br; } xml_parser_free($xml_parser); [/code] The Error output is ... [code] XML error in given source on Line: 1 Column: 32 Reason: MessageWere changing/Message [/code] Anyone know?? I'm using PHP version 4.3.2 Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Bug/Error with XML Parsing Syntax??
On Mon, June 13, 2005 10:21 am, Scott Fletcher said: I'm not sure what's wrong with PHP.. I ran the XML file through the Mozilla and it validate just fine. I get XML parse error but it gave no reason for the errors. The source code here is [code] $data = MessageWere changing/Message; $xml_parser = xml_parser_create('ISO-8859-1'); xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($xml_parser, trim($data), $vals, $index); if (xml_error_string($xml_parser)) { echo br; echo XML error in given source on br; echo Line: .xml_get_current_line_number($xml_parser).br; echo Column: .xml_get_current_column_number($xml_parser).br; echo Reason: .xml_error_string(xml_get_error_code($xml_parser)).br; echo br; echo XML Data: .$data; echo br; } xml_parser_free($xml_parser); [/code] The Error output is ... [code] XML error in given source on Line: 1 Column: 32 Reason: MessageWere changing/Message [/code] Anyone know?? I'm using PHP version 4.3.2 Thanks Wild Guess! Column 32 is the end of your data. Perhaps it wants a newline??? Or, perhaps, you need something like a doctype at the beginning? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Bug/Error with XML Parsing Syntax??
Finally, the newsgroup start working once again... The problem was if (xml_error_string($xml_parser)) { which I was told should be if (xml_get_error_code($xml_parser) != XML_ERROR_NONE) { It solve my problem now. Now how do I parse the DTD's entity, element, etc along with the PHP's xml_parse_into_struct() I figured that I would need to add another function before that to make it work. So, can anyone give me an example that would do the trick?? XML Code is --snip-- ?xml version=1.0 standalone=yes? !DOCTYPE NewsFeed [ !ENTITY nbsp test ] NewsFeed Message Blah nbsp;nbsp;nbsp;Arcadia, nbsp;nbsp;nbsp;nbsp;nbsp;TranSouth /Message /NewsFeed --snip-- I got --snip-- Blah Arcadia, TransSouth --snip-- with no nbsp; within those data in the Message tag.. Thanks... FletchSOD Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, June 13, 2005 10:21 am, Scott Fletcher said: I'm not sure what's wrong with PHP.. I ran the XML file through the Mozilla and it validate just fine. I get XML parse error but it gave no reason for the errors. The source code here is [code] $data = MessageWere changing/Message; $xml_parser = xml_parser_create('ISO-8859-1'); xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($xml_parser, trim($data), $vals, $index); if (xml_error_string($xml_parser)) { echo br; echo XML error in given source on br; echo Line: .xml_get_current_line_number($xml_parser).br; echo Column: .xml_get_current_column_number($xml_parser).br; echo Reason: .xml_error_string(xml_get_error_code($xml_parser)).br; echo br; echo XML Data: .$data; echo br; } xml_parser_free($xml_parser); [/code] The Error output is ... [code] XML error in given source on Line: 1 Column: 32 Reason: MessageWere changing/Message [/code] Anyone know?? I'm using PHP version 4.3.2 Thanks Wild Guess! Column 32 is the end of your data. Perhaps it wants a newline??? Or, perhaps, you need something like a doctype at the beginning? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP bug within multi. dimensional arrays?
Hi there, I am outputting an multidim. array. That works fine, except one thing. The first letter of the value inside dimension 1 always gets printed. For example: I fill the arrays: while ($row = mysql_fetch_object($result)){ $cat[$row-main_id][name]= $row-main_name; $cat[$row-main_id][$row-sub_id][name] = $row-sub_name; } Then I output them: foreach ($cat AS $maincat){ echo $maincat[name].':'; foreach($maincat AS $subcat){ echo $subcat[name].$br; } echo $br; } Which does result in: Europe:E Germany UK North America:N US CA As you can see I get the extra letters N and E. Is this an php error or did I do something wrong? Thanx for any hint, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP bug within multi. dimensional arrays?
Hello Merlin, Monday, June 6, 2005, 2:51:39 PM, you wrote: M while ($row = mysql_fetch_object($result)){ M $cat[$row-main_id][name] = $row-main_name; M $cat[$row-main_id][$row-sub_id][name] = M $row-sub_name; M } Quote array keys.. ALWAYS quote them: $cat[$blah]['name'] = $whatever Otherwise PHP will think [name] is trying to use a constant and substitute a value accordingly. M foreach ($cat AS $maincat){ M echo $maincat[name].':'; M foreach($maincat AS $subcat){ M echo $subcat[name].$br; M } M echo $br; M } M As you can see I get the extra letters N and E. Is this an php M error or did I do something wrong? You did something wrong ;) If you don't quote the array keys it'll assume a constant, which in turn would assume a 1 which will give you the first character of the string. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP bug within multi. dimensional arrays?
Richard Davey wrote: Hello Merlin, Monday, June 6, 2005, 2:51:39 PM, you wrote: M while ($row = mysql_fetch_object($result)){ M $cat[$row-main_id][name] = $row-main_name; M $cat[$row-main_id][$row-sub_id][name] = M $row-sub_name; M } Quote array keys.. ALWAYS quote them: $cat[$blah]['name'] = $whatever Otherwise PHP will think [name] is trying to use a constant and substitute a value accordingly. M foreach ($cat AS $maincat){ M echo $maincat[name].':'; M foreach($maincat AS $subcat){ M echo $subcat[name].$br; M } M echo $br; M } M As you can see I get the extra letters N and E. Is this an php M error or did I do something wrong? You did something wrong ;) If you don't quote the array keys it'll assume a constant, which in turn would assume a 1 which will give you the first character of the string. Best regards, Richard Davey Hi Richard, that sounds absolutly plausible and I now qoted it the way you recommended. However I do get the same result. Still the first letter. Any other ideas? Thank you in advance, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP bug within multi. dimensional arrays?
On Mon, June 6, 2005 6:51 am, Merlin said: I am outputting an multidim. array. That works fine, except one thing. The first letter of the value inside dimension 1 always gets printed. For example: I fill the arrays: while ($row = mysql_fetch_object($result)){ $cat[$row-main_id][name] = $row-main_name; For the record, name does not turn into 0, 1, nor TRUE here, but simply becomes 'name' which is what you should have typed in the first place. Set error_reporting(E_ALL) to get more details. $cat[$row-main_id][$row-sub_id][name] = $row-sub_name; } Then I output them: foreach ($cat AS $maincat){ echo $maincat[name].':'; echo maincat is: '$maincat'br /\n; foreach($maincat AS $subcat){ echo subcat is: '$subcat'br /\n; echo $subcat[name].$br; } echo $br; } Which does result in: Europe:E You are passing 'Europe' as $subcat, and then trying to treat it like an array when you do $subcat['name']. PHP will let you treat a string as an array of characters, if you insist. At this point, PHP *does* turn 'name' into the index 0 because you can only index strings as character arrays using integer indices. $subcat['name'] = 'Europe'['name'] = 'Europe'[0] = 'E' Germany UK North America:N US CA As you can see I get the extra letters N and E. Is this an php error or did I do something wrong? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Curious bug and crash
Hi, Tonight I installed a new php5 instance. php5.0.4/apache-1.3.33/mysql-4.1.10. I was getting \Wed May 18 01:59:42 2005] [notice] child pid 1621 exit signal Segmentation fault (11) error whenever I accessed a PHP enable page. I recompiled a few times and removed unnecessary modules. Still the same problem. So in order to get a debug output, I recompiled with --enable-debug. The curious thing is, now the error doesn't occur. Anyone any ideas? Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Bug, erreurs ou non =?iso-8859-1?q?document=E9?=
On Wednesday 04 May 2005 22:47, Amir Mohammad Saied wrote: Bonjour Amir C'est liste est en Anglais. Cependant, la réponse: Il est necessaire de 'eschapper' le character '\' Au lieux d'ecrire '\', il faut ecrire '\\' Donc si le chemin est \\srvdfs00\partages\0-50\M7\05_APValidation\Forfait_Entreprise Il faut le changer en srvdfs00\\partages\\0-50\\M7\\05_APValidation\\Forfait_Entreprise Svp, repondéz en ANGLAIS [EMAIL PROTECTED] wrote: Bonjour, J'utilise php en profondeur depuis peu. Je viens d'utiliser les fonctions sur les fichier tel que is_file(), is_dir() ou encore file_exists(). J'obtiens des résultat qui ne correspondent pas à la documentation. Apparement la longueur de chaîne influe sur le résultat obtenu. En effet voici le test simple que j'ai effectuer : $file = \\\srvdfs00\\partages\\0-50\\M7\\05_APValidation\\Forfait_Entreprise _Chaîne_de_Valeur; echo len : . strlen($file) .br; echo file : . $file . br; if (is_dir($file)) { echo false; } else { echo true; } echo br; $file = \\\srvdfs00\\partages\\0-50\\M7\\05_APValidation\\Forfait_Entreprise _Chaîne_de_Valeur\\Entreprise; echo len : . strlen($file) .br; echo file : . $file . br; if (is_dir($file)) { echo false; } else { echo true; } echo br; Voici le résultat : len : 83 file : \\srvdfs00\partages\0-50\M7\05_APValidation\Forfait_Entreprise_Chaîne _de_Valeur false len : 94 file : \\srvdfs00\partages\0-50\M7\05_APValidation\Forfait_Entreprise_Chaîne _de_Valeur\Entreprise true Il est evident que j'ai tester les 2 repertoires dans un explorateur windows et que les chemins sont les bons. Je suis sous NT et le partage réseau doit surement être sous windows Merci de votre réponse. Jérémy Hennegrave (Pour Bouygues Telecom) Here is an english newsgroup, please ask your question in english, or go to your language sections -- Registered Linux User Number 379093 -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug, erreurs ou non =?ISO-8859-1?Q?document=E9?=
[EMAIL PROTECTED] wrote: Bonjour, J'utilise php en profondeur depuis peu. Je viens d'utiliser les fonctions sur les fichier tel que is_file(), is_dir() ou encore file_exists(). J'obtiens des résultat qui ne correspondent pas à la documentation. Apparement la longueur de chaîne influe sur le résultat obtenu. En effet voici le test simple que j'ai effectuer : $file = \\\srvdfs00\\partages\\0-50\\M7\\05_APValidation\\Forfait_Entreprise_Chaîne_de_Valeur; echo len : . strlen($file) .br; echo file : . $file . br; if (is_dir($file)) { echo false; } else { echo true; } echo br; $file = \\\srvdfs00\\partages\\0-50\\M7\\05_APValidation\\Forfait_Entreprise_Chaîne_de_Valeur\\Entreprise; echo len : . strlen($file) .br; echo file : . $file . br; if (is_dir($file)) { echo false; } else { echo true; } echo br; Voici le résultat : len : 83 file : \\srvdfs00\partages\0-50\M7\05_APValidation\Forfait_Entreprise_Chaîne_de_Valeur false len : 94 file : \\srvdfs00\partages\0-50\M7\05_APValidation\Forfait_Entreprise_Chaîne_de_Valeur\Entreprise true Il est evident que j'ai tester les 2 repertoires dans un explorateur windows et que les chemins sont les bons. Je suis sous NT et le partage réseau doit surement être sous windows Merci de votre réponse. Jérémy Hennegrave (Pour Bouygues Telecom) Here is an english newsgroup, please ask your question in english, or go to your language sections -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strtotime() bug?
On Mon, April 4, 2005 3:14 pm, Al said: Suddenly my strtotime() are goofy, anyone have any ideas? echo date('Y/m/d/H', time()). br; //2005/04/04/18 echo date('Y/m/d/H', strtotime(-1 day)). br; //2005/04/03/18 echo date('Y/m/d/H', strtotime(last Sunday)). br; //2005/04/02/23 Sunday shows as Saturday. If the BIOS thinks you don't use Daylight Savings, but the OS thinks you *DO* use Daylight Savings, but Locale thinks you don't use Daylight Savings, but... Or any variation on that theme. This is just theory of what could be going wrong, without my delving too deeply into what you typed... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strtotime() bug?
Suddenly my strtotime() are goofy, anyone have any ideas? echo date('Y/m/d/H', time()). br; //2005/04/04/18 echo date('Y/m/d/H', strtotime(-1 day)). br; //2005/04/03/18 echo date('Y/m/d/H', strtotime(last Sunday)). br; //2005/04/02/23 Sunday shows as Saturday. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug or undocumented functionality of unset()?
[EMAIL PROTECTED] wrote: Hi All, Does unset() create a copy of the array and then overwrite the original somehow destroying the reference? ... --- ?php $stuff = array(array('one','two'), array('one','two'), array('three','four'), array('five','six'), array('seven','eight'), array('nine','ten')); print 'pre'; print_r($stuff); print '/pre'; foreach ($stuff as $key = $values) { This kind of array manipulation only works in PHP5... which I assume you are using? print on key:$keybr; if(($key%2)==0){ print Running unset for $key br; unset ($stuff[$key]); This works fine for me... again, using PHP5 here. }else{ print Running change for $key br; $values[1]='foo'; Now this is an interesting problem. It seems that $values[1] is not being changed. I don't know if this is a quirk or not, but since $values should be a reference I would expect it to work for values that are arrays (and not just scalars). Check out bugs.php.net for this part of the problem. Seems the root issue here is that array references only work for scalar values. This is also a PHP5-only issue (since foreach references wasn't a feature of PHP4). //$stuff[$key][1] = 'foo'; Using foreach in PHP4 you would have to do something like the line above to change a value. It appears that this is also the only way to do it in PHP5? ... but IMO this shouldn't be the way it is... } } print 'pre'; print_r($stuff); print '/pre'; ? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] COM Bug in PHP 4.3.10
Hi, I need to know when will be the next PHP 4.3.x release with the fix for the COM bug which was in 4.3.10. This is CRITICAL for us, because we run our application over windows using COM object and we use earlier version of PHP which has security bugs. COM Bug URL: http://bugs.php.net/bug.php?id=31159 Thanks, Tohar Trabinovitch Software Engineer E: [EMAIL PROTECTED] T: 972-3-9008269 C: 054-777 30 43 This message is intended only for the person(s) to which it is addressed and may contain Sphera Corporation privileged, confidential and/or proprietary information. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Any disclosure, copying, distribution, or the taking of any action concerning the contents of this message and any attachment(s) by anyone other than the named recipient(s) is strictly prohibited.
[PHP] debug_backtrace bug?
I wanted to run this past the list before submitting a bug report. (I've searched the bugs and haven't found anything relevant to my problem.) The problem is that when s method of one class is overridden in a subclass, debug_backtrace() doesn't distinguish between the two methods. For example, this code: class A { function __construct() { $bt = debug_backtrace(); foreach ($bt as $t) print $t['class'].::.$t['function'].br; } } class B extends A { function __construct() { parent::__construct(); } } $b = new B(); ...produces this output: B::__construct B::__construct ...instead of the output I'd expect: A::__construct B::__construct It happens for regular methods also, not just constructors. Is this a bug, or is this behavior correct for some reason? (Tested in php 5.0.0, 5.0.1, and 5.0.2) Thanks. Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] debug_backtrace bug?
The 'class' index reflects what __CLASS__ constant would show. Bug report: http://bugs.php.net/22960 Status: It works as expected and intended. Thomas Peri wrote: I wanted to run this past the list before submitting a bug report. (I've searched the bugs and haven't found anything relevant to my problem.) The problem is that when s method of one class is overridden in a subclass, debug_backtrace() doesn't distinguish between the two methods. For example, this code: class A { function __construct() { $bt = debug_backtrace(); foreach ($bt as $t) print $t['class'].::.$t['function'].br; } } class B extends A { function __construct() { parent::__construct(); } } $b = new B(); ...produces this output: B::__construct B::__construct ...instead of the output I'd expect: A::__construct B::__construct It happens for regular methods also, not just constructors. Is this a bug, or is this behavior correct for some reason? (Tested in php 5.0.0, 5.0.1, and 5.0.2) Thanks. Thomas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] debug_backtrace bug?
Marek Kilimajer wrote: The 'class' index reflects what __CLASS__ constant would show. Bug report: http://bugs.php.net/22960 Status: It works as expected and intended. right, but this states that __CLASS__ is bar inside bar::b() and is foo inside foo::b(). In this case, debug_backtrace() is reporting that __CLASS__ is foo inside bar::b(). Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Bug-Tracking-System in PHP ?
Hmmm No email support?? When a bug is posted, updated, a bug note is added, etc everyone who subscribed to this 'topic' will receive a email on it We use it in our firm and it works like a charm :) -Original Message- From: Michelle Konzack [mailto:[EMAIL PROTECTED] Sent: vrijdag 29 oktober 2004 16:51 To: [EMAIL PROTECTED] Subject: [PHP] Re: Bug-Tracking-System in PHP ? Am 2004-10-29 09:48:32, schrieb Reinhart Viane: Dunno if this is ok: http://www.mantisbt.org/ Nice features and 1.0 support postgresql (can not use MySQL because some tools conflicts with postgresql) Unfortunatly no E-Mail support... :-( Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug-Tracking-System in PHP ?
Am 2004-10-29 09:48:32, schrieb Reinhart Viane: Dunno if this is ok: http://www.mantisbt.org/ Nice features and 1.0 support postgresql (can not use MySQL because some tools conflicts with postgresql) Unfortunatly no E-Mail support... :-( Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [PHP] Re: Bug-Tracking-System in PHP ?
On Fri, 2004-10-29 at 16:51 +0200, Michelle Konzack wrote: Am 2004-10-29 09:48:32, schrieb Reinhart Viane: Dunno if this is ok: http://www.mantisbt.org/ Nice features and 1.0 support postgresql (can not use MySQL because some tools conflicts with postgresql) How do mysql and postgresql tools conflict? You should have no problem running them side by side... or even several of each on the same machine. They don't obsolete each other or cause dependancy issues. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development *--- Now supporting PHP5 --- / signature.asc Description: This is a digitally signed message part
Re: [PHP] Re: Bug-Tracking-System in PHP ?
On Fri, 29 Oct 2004 16:51:06 +0200, Michelle Konzack [EMAIL PROTECTED] wrote: http://www.mantisbt.org/ Nice features and 1.0 support postgresql (can not use MySQL because some tools conflicts with postgresql) A database abstraction layer might be the solution to that. ADOdb is very good. adodb.sf.net My favorite feature is the md5 bzip'd PHP sessions. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Bug with mktime??
On Tue, 31 Aug 2004 09:53:01 +1200, in php.general [EMAIL PROTECTED] (John Clegg) wrote: I have been using mktime() to determine the next 12 months for a program, and i have discovered what seems a bug in the function. The following code... ?php for($i=0;$i 12;$i++){ $currentDate = date(d m Y,mktime(0, 0, 0,date(m)+$i , date(d), date(Y))); There is no bug. Currently it is the 31. august. For $i ==1, you are setting the date to 31. september = 1. october. For $i ==2, you are setting the date to 31. october For $i ==3, you are setting the date to 31. november = 1. december For $i ==4, you are setting the date to 31. december .. and so on. Since you only look at the month, you would get october, october, december, december, etc. -- - Peter Brodersen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP bug tracker, it is freely available
Christian Stocker wrote: http://cvs.php.net/php-bugs-web/ Thanks! Now, is there any installation documentation? ;) Can't seem to find any under php-bugs-web. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP bug tracker, it is freely available
I absolutely love the PHP bug tracker and was wondering if it freely available software or software internal to php.net only? I've looked around but can't find a link to it anywhere. -- Jean-Christian Imbeault Assistant Manager Technology Department _ Mizuho Securities Co, Ltd. Tel: (03) 5208-2932 (direct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP bug tracker, it is freely available
http://cvs.php.net/php-bugs-web/ chregu On Fri, 13 Aug 2004 18:18:45 +0900, Jean-Christian Imbeault [EMAIL PROTECTED] wrote: I absolutely love the PHP bug tracker and was wondering if it freely available software or software internal to php.net only? I've looked around but can't find a link to it anywhere. -- Jean-Christian Imbeault Assistant Manager Technology Department _ Mizuho Securities Co, Ltd. Tel: (03) 5208-2932 (direct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net bug tracking tool?
Curt, thank you. I like Mantis, too but wanted to check the php thing. I was confused there is no reference to it anywhere, as it's used by e.g. MySQL, too. Thanks, Andreas Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Andreas Goetz: Which bug tracking tool is php.net using? I know it sounds stupid, but even as I can look at the source on php.net, I can't find any documentation- is this package available for download somewhere? you can checkout the code from cvs: cvs -d :pserver:[EMAIL PROTECTED]:/repository checkout php-bugs-web see: http://cvs.php.net/php-bugs-web http://www.php.net/anoncvs.php you might be better off finding a more generic bug tracking system. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php.net bug tracking tool?
Which bug tracking tool is php.net using? I know it sounds stupid, but even as I can look at the source on php.net, I can't find any documentation- is this package available for download somewhere? Thanks, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net bug tracking tool?
* Thus wrote Andreas Goetz: Which bug tracking tool is php.net using? I know it sounds stupid, but even as I can look at the source on php.net, I can't find any documentation- is this package available for download somewhere? you can checkout the code from cvs: cvs -d :pserver:[EMAIL PROTECTED]:/repository checkout php-bugs-web see: http://cvs.php.net/php-bugs-web http://www.php.net/anoncvs.php you might be better off finding a more generic bug tracking system. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 Bug with DOMDocument-xinclude
Hi, Can anyone tell me if they faced a similar problem. When I manually save the following line into an file, it works xi:include href=xml_file.xml parse=xml/ But if I remove this line, and add it dynamically using the following code, and only after that call $xml_file-xinclude(); it does not work $new_node = $xml_file-createElement('xi:include'); $new_node-setAttribute ('href', xml_file.xml); $new_node-setAttribute ('parse', 'xml'); $parent-appendChild($new_node); ($parent was set, so the error is not there) After all the xinclude command, I write the o/p using saveXML() and I see the xi:include href=xml_file.xml parse=xml/ in the file unprocessed. Any ideas? Any work arounds for now? - Sid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 Bug with DOMDocument-xinclude
Cool that worked :-) Thanks. BTW your presentation on your site was very useful. - Sid On Wed, 21 Jul 2004 13:25:11 +0200, Christian Stocker [EMAIL PROTECTED] wrote: On Wed, 21 Jul 2004 16:02:54 +0530, Siddharth Hegde [EMAIL PROTECTED] wrote: Hi, Can anyone tell me if they faced a similar problem. When I manually save the following line into an file, it works xi:include href=xml_file.xml parse=xml/ But if I remove this line, and add it dynamically using the following code, and only after that call $xml_file-xinclude(); it does not work $new_node = $xml_file-createElement('xi:include'); $new_node-setAttribute ('href', xml_file.xml); $new_node-setAttribute ('parse', 'xml'); $parent-appendChild($new_node); ($parent was set, so the error is not there) After all the xinclude command, I write the o/p using saveXML() and I see the xi:include href=xml_file.xml parse=xml/ in the file unprocessed. Any ideas? Any work arounds for now? No workaround, just use the correct methods for inserting elements with a namespace ;) $new_node = $xml_file-createElementNS(XINCLUDE_NAMESPACE, 'include'); XINCLUDE_NAMESPACE is of course to be replaced with tha actual xinclude namespace... (too lazy to look it..) chregu - Sid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php