php-general Digest 24 Aug 2009 06:55:03 -0000 Issue 6302
php-general Digest 24 Aug 2009 06:55:03 - Issue 6302 Topics (messages 297111 through 297111): Re: wierd behavior on parsing css with no php included 297111 by: Jim Lucas Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- Ralph Deffke wrote: Hi folks, i did post this also on the Wamp page but maybe someone out there had to solve that problem as well. systems involved Firefox 3.0.13 Firefox 3.5.2 IE 6 Wamp: apache 2.2.11 PHP 5.2.9 php 5.3 I do parse css files through php If you state that they have not PHP to parse, then why parse them? It is a waist! Problem: css files are loaded into the browsers but not interpreted or used on RAW HTML files no php included. The html files are produced with phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display the page, Firefox NOT AT ALL. I think it might be possible that wamp throughs some wierd characters into the css files or is the header type a problem? It looks like parsing the css through the php engine changes the header of the css to text/html. this would explain why IE6 can use them. on the other hand firebug shows the loaded css, indicates however that no css is available. as an reverse check I did load the html files direktly from the disk with file:/// ... and the css are interpreted perfectly. so the source of the problem is wamp. it seems that the @importcsss does the biggest problem.it creates a 404 error file not found it seems creating dynamic css files got some secrets involved with the wamp. I'm using this concept since ages on linux with no problem. on the @includecss it seems that the search for files are changing to the php include path or something. any idear what to check? is important for my work to create css dynamicly My suggestion would be to have php run a script using the auto_prepend_file ini option ; Automatically add files before or after any PHP document. auto_prepend_file = fix_headers.php auto_append_file = Then, in a script called fix_headers.php, somewhere in your path I hope, you have this. ?php # The following regex is completely untested. It is meant to $ext = strtolower(preg_replace('|^.*\.([^.]+)$|', $_SERVER['SCRIPT_NAME'])); if ( 'css' === $ext ) { header('Content-Type: text/css'); } ? Another way to get around it is to have apache instruct PHP to change, and output, the correct content type. http://httpd.apache.org/docs/1.3/mod/core.html#files http://us2.php.net/manual/en/ini.core.php#ini.sect.data-handling http://us2.php.net/manual/en/ini.core.php#ini.default-mimetype Files ~ \.css$ php_value default_mimetype text/css /Files Hope this helps Jim Lucas ralph_def...@yahoo.de -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare ---End Message---
php-general Digest 24 Aug 2009 19:27:56 -0000 Issue 6303
php-general Digest 24 Aug 2009 19:27:56 - Issue 6303 Topics (messages 297112 through 297140): unset( $anobject) does not invoce __destruct() 297112 by: Ralph Deffke 297115 by: kranthi 297116 by: Stuart 297117 by: Lupus Michaelis 297118 by: Ralph Deffke 297120 by: Ashley Sheridan 297121 by: Ralph Deffke 297123 by: Luke 297124 by: Ralph Deffke 297127 by: Stuart 297138 by: hack988 hack988 Re: wierd behavior on parsing css with no php included 297113 by: Ralph Deffke 297114 by: Ashley Sheridan Re: Is there limitation for switch case: argument's value? 297119 by: tedd Re: preg_replace anything that isn't WORD 297122 by: tedd Re: SESSIONS lost sometimes 297125 by: Angelo Zanetti Multiple EXEC() hang Apache 297126 by: Andrioli Darvin inserting php value in html shorter wayand downloading winword mp3 files the fancy way 297128 by: Grega LeskovÅ¡ek 297129 by: Ashley Sheridan 297135 by: Paul M Foster What if this code is right ? It worked perfectly for years!! 297130 by: Chris Carter 297131 by: Ashley Sheridan 297132 by: Lars Torben Wilson 297133 by: Paul M Foster 297134 by: Warren Vail 297136 by: Ashley Sheridan 297137 by: Chris Carter PHP pages won't open correctly on my server. 297139 by: RRT 297140 by: Ryan Cavicchioni Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- but it should? shouldn't it how can I destroy a class instance invocing __detruct() of the class ?!?!? ---End Message--- ---BeginMessage--- unset($obj) always calls the __destruct() function of the class. in your case clearly you are missing something else. Probably unset($anobject) is not being called at all ? ---End Message--- ---BeginMessage--- 2009/8/24 kranthi kranthi...@gmail.com: unset($obj) always calls the __destruct() function of the class. in your case clearly you are missing something else. Probably unset($anobject) is not being called at all ? That's not entirely correct. PHP uses reference counting, so if unsetting a variable did not cause the object to be destructed then it's highly likely that there is another variable somewhere that is holding a reference to that object. -Stuart -- http://stut.net/ ---End Message--- ---BeginMessage--- kranthi wrote: unset($obj) always calls the __destruct() function of the class. Never calls the dtor. The dtor will be called only when the reference count reaches 0. class c { function __destruct() { echo 'dying !' ; } } $v1 = new c ; $v2 = $v1 ; unset($v1) ; // don't call the dtor unset($v2) ; // call the dtor -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org ---End Message--- ---BeginMessage--- that is correct and that is the problem, and even that is not all !!! try this ?php abstract class a { public function __construct(){ echo constructingbr; } public function __detruct(){ echo destructingbr; } } class b extends a{ } $c = new b(); unset( $c ); ? the constructor is inherited, the destructor not !! PHP 5.2.9-1 and PHP 5.3.0 behave the same las trampas de la vida ralph_def...@yahoo.de Stuart stut...@gmail.com wrote in message news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com... 2009/8/24 kranthi kranthi...@gmail.com: unset($obj) always calls the __destruct() function of the class. in your case clearly you are missing something else. Probably unset($anobject) is not being called at all ? That's not entirely correct. PHP uses reference counting, so if unsetting a variable did not cause the object to be destructed then it's highly likely that there is another variable somewhere that is holding a reference to that object. -Stuart -- http://stut.net/ ---End Message--- ---BeginMessage--- On Mon, 2009-08-24 at 15:13 +0200, Ralph Deffke wrote: that is correct and that is the problem, and even that is not all !!! try this ?php abstract class a { public function __construct(){ echo constructingbr; } public function __detruct(){ echo destructingbr; } } class b extends a{ } $c = new b(); unset( $c ); ? the constructor is inherited, the destructor not !! PHP 5.2.9-1 and PHP 5.3.0 behave the same las trampas de la vida ralph_def...@yahoo.de Stuart stut...@gmail.com wrote in message news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com... 2009/8/24 kranthi kranthi...@gmail.com: unset($obj) always calls the __destruct() function of the class. in your case clearly you
Re: [PHP] wierd behavior on parsing css with no php included
Ralph Deffke wrote: Hi folks, i did post this also on the Wamp page but maybe someone out there had to solve that problem as well. systems involved Firefox 3.0.13 Firefox 3.5.2 IE 6 Wamp: apache 2.2.11 PHP 5.2.9 php 5.3 I do parse css files through php If you state that they have not PHP to parse, then why parse them? It is a waist! Problem: css files are loaded into the browsers but not interpreted or used on RAW HTML files no php included. The html files are produced with phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display the page, Firefox NOT AT ALL. I think it might be possible that wamp throughs some wierd characters into the css files or is the header type a problem? It looks like parsing the css through the php engine changes the header of the css to text/html. this would explain why IE6 can use them. on the other hand firebug shows the loaded css, indicates however that no css is available. as an reverse check I did load the html files direktly from the disk with file:/// ... and the css are interpreted perfectly. so the source of the problem is wamp. it seems that the @importcsss does the biggest problem.it creates a 404 error file not found it seems creating dynamic css files got some secrets involved with the wamp. I'm using this concept since ages on linux with no problem. on the @includecss it seems that the search for files are changing to the php include path or something. any idear what to check? is important for my work to create css dynamicly My suggestion would be to have php run a script using the auto_prepend_file ini option ; Automatically add files before or after any PHP document. auto_prepend_file = fix_headers.php auto_append_file = Then, in a script called fix_headers.php, somewhere in your path I hope, you have this. ?php # The following regex is completely untested. It is meant to $ext = strtolower(preg_replace('|^.*\.([^.]+)$|', $_SERVER['SCRIPT_NAME'])); if ( 'css' === $ext ) { header('Content-Type: text/css'); } ? Another way to get around it is to have apache instruct PHP to change, and output, the correct content type. http://httpd.apache.org/docs/1.3/mod/core.html#files http://us2.php.net/manual/en/ini.core.php#ini.sect.data-handling http://us2.php.net/manual/en/ini.core.php#ini.default-mimetype Files ~ \.css$ php_value default_mimetype text/css /Files Hope this helps Jim Lucas ralph_def...@yahoo.de -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unset( $anobject) does not invoce __destruct()
but it should? shouldn't it how can I destroy a class instance invocing __detruct() of the class ?!?!? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wierd behavior on parsing css with no php included
perfect, thats what I was looking for, great thanks ralph Jim Lucas li...@cmsws.com wrote in message news:4a923946.3020...@cmsws.com... Ralph Deffke wrote: Hi folks, i did post this also on the Wamp page but maybe someone out there had to solve that problem as well. systems involved Firefox 3.0.13 Firefox 3.5.2 IE 6 Wamp: apache 2.2.11 PHP 5.2.9 php 5.3 I do parse css files through php If you state that they have not PHP to parse, then why parse them? It is a waist! Problem: css files are loaded into the browsers but not interpreted or used on RAW HTML files no php included. The html files are produced with phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display the page, Firefox NOT AT ALL. I think it might be possible that wamp throughs some wierd characters into the css files or is the header type a problem? It looks like parsing the css through the php engine changes the header of the css to text/html. this would explain why IE6 can use them. on the other hand firebug shows the loaded css, indicates however that no css is available. as an reverse check I did load the html files direktly from the disk with file:/// ... and the css are interpreted perfectly. so the source of the problem is wamp. it seems that the @importcsss does the biggest problem.it creates a 404 error file not found it seems creating dynamic css files got some secrets involved with the wamp. I'm using this concept since ages on linux with no problem. on the @includecss it seems that the search for files are changing to the php include path or something. any idear what to check? is important for my work to create css dynamicly My suggestion would be to have php run a script using the auto_prepend_file ini option ; Automatically add files before or after any PHP document. auto_prepend_file = fix_headers.php auto_append_file = Then, in a script called fix_headers.php, somewhere in your path I hope, you have this. ?php # The following regex is completely untested. It is meant to $ext = strtolower(preg_replace('|^.*\.([^.]+)$|', $_SERVER['SCRIPT_NAME'])); if ( 'css' === $ext ) { header('Content-Type: text/css'); } ? Another way to get around it is to have apache instruct PHP to change, and output, the correct content type. http://httpd.apache.org/docs/1.3/mod/core.html#files http://us2.php.net/manual/en/ini.core.php#ini.sect.data-handling http://us2.php.net/manual/en/ini.core.php#ini.default-mimetype Files ~ \.css$ php_value default_mimetype text/css /Files Hope this helps Jim Lucas ralph_def...@yahoo.de -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] wierd behavior on parsing css with no php included
On Mon, 2009-08-24 at 10:58 +0200, Ralph Deffke wrote: perfect, thats what I was looking for, great thanks ralph Jim Lucas li...@cmsws.com wrote in message news:4a923946.3020...@cmsws.com... Ralph Deffke wrote: Hi folks, i did post this also on the Wamp page but maybe someone out there had to solve that problem as well. systems involved Firefox 3.0.13 Firefox 3.5.2 IE 6 Wamp: apache 2.2.11 PHP 5.2.9 php 5.3 I do parse css files through php If you state that they have not PHP to parse, then why parse them? It is a waist! Problem: css files are loaded into the browsers but not interpreted or used on RAW HTML files no php included. The html files are produced with phpDocumentor 1.4.2. IE6 uses parts of the css files loaded to display the page, Firefox NOT AT ALL. I think it might be possible that wamp throughs some wierd characters into the css files or is the header type a problem? It looks like parsing the css through the php engine changes the header of the css to text/html. this would explain why IE6 can use them. on the other hand firebug shows the loaded css, indicates however that no css is available. as an reverse check I did load the html files direktly from the disk with file:/// ... and the css are interpreted perfectly. so the source of the problem is wamp. it seems that the @importcsss does the biggest problem.it creates a 404 error file not found it seems creating dynamic css files got some secrets involved with the wamp. I'm using this concept since ages on linux with no problem. on the @includecss it seems that the search for files are changing to the php include path or something. any idear what to check? is important for my work to create css dynamicly My suggestion would be to have php run a script using the auto_prepend_file ini option ; Automatically add files before or after any PHP document. auto_prepend_file = fix_headers.php auto_append_file = Then, in a script called fix_headers.php, somewhere in your path I hope, you have this. ?php # The following regex is completely untested. It is meant to $ext = strtolower(preg_replace('|^.*\.([^.]+)$|', $_SERVER['SCRIPT_NAME'])); if ( 'css' === $ext ) { header('Content-Type: text/css'); } ? Another way to get around it is to have apache instruct PHP to change, and output, the correct content type. http://httpd.apache.org/docs/1.3/mod/core.html#files http://us2.php.net/manual/en/ini.core.php#ini.sect.data-handling http://us2.php.net/manual/en/ini.core.php#ini.default-mimetype Files ~ \.css$ php_value default_mimetype text/css /Files Hope this helps Jim Lucas ralph_def...@yahoo.de -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare Just out of curiosity, which solution was it that worked? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
that is correct and that is the problem, and even that is not all !!! try this ?php abstract class a { public function __construct(){ echo constructingbr; } public function __detruct(){ echo destructingbr; } } class b extends a{ } $c = new b(); unset( $c ); ? the constructor is inherited, the destructor not !! PHP 5.2.9-1 and PHP 5.3.0 behave the same las trampas de la vida ralph_def...@yahoo.de Stuart stut...@gmail.com wrote in message news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com... 2009/8/24 kranthi kranthi...@gmail.com: unset($obj) always calls the __destruct() function of the class. in your case clearly you are missing something else. Probably unset($anobject) is not being called at all ? That's not entirely correct. PHP uses reference counting, so if unsetting a variable did not cause the object to be destructed then it's highly likely that there is another variable somewhere that is holding a reference to that object. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there limitation for switch case: argument's value?
At 9:44 PM -0700 8/22/09, Lars Torben Wilson wrote: Hi Keith, Glad it works! I'm not sure how inverting the case statement helps you minimize the code in each case. As both I and Adam showed, you can do the same thing more efficiently (and IMHO much more readably) like this: switch ($sum) { case 8: break; case 7: case 6: break; case 2: case 1: break; case 0: break; default: break; } Additionally, I would argue there's nothing different below other than it's even more easier to read and understand: switch ($sum) { case 0: break; case 1: case 2: break; case 6: case 7: break; case 8: break; default: break; } Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
On Mon, 2009-08-24 at 15:13 +0200, Ralph Deffke wrote: that is correct and that is the problem, and even that is not all !!! try this ?php abstract class a { public function __construct(){ echo constructingbr; } public function __detruct(){ echo destructingbr; } } class b extends a{ } $c = new b(); unset( $c ); ? the constructor is inherited, the destructor not !! PHP 5.2.9-1 and PHP 5.3.0 behave the same las trampas de la vida ralph_def...@yahoo.de Stuart stut...@gmail.com wrote in message news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com... 2009/8/24 kranthi kranthi...@gmail.com: unset($obj) always calls the __destruct() function of the class. in your case clearly you are missing something else. Probably unset($anobject) is not being called at all ? That's not entirely correct. PHP uses reference counting, so if unsetting a variable did not cause the object to be destructed then it's highly likely that there is another variable somewhere that is holding a reference to that object. -Stuart -- http://stut.net/ That would seem sensible to me though really. A constructor only bears true for the base class, so any classes which inherit it must incorporate all the constructor parts. A destructor doesn't know about further classes which will need to inherit it, so it shouldn't be inherited and the new class should sort things out. At least, that's how I see it. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
typing error sorry forget my last post is there a was to destroy an object if there is hold a reference somewhere? Stuart stut...@gmail.com wrote in message news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com... 2009/8/24 kranthi kranthi...@gmail.com: unset($obj) always calls the __destruct() function of the class. in your case clearly you are missing something else. Probably unset($anobject) is not being called at all ? That's not entirely correct. PHP uses reference counting, so if unsetting a variable did not cause the object to be destructed then it's highly likely that there is another variable somewhere that is holding a reference to that object. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace anything that isn't WORD
On Sat, Aug 22, 2009 at 12:32 PM, ÈýÏÝÂÔdanondan...@gmail.com wrote: Lets assume I have the string cats i saw a cat and a dog i want to strip everything except cat and dog so the result will be catcatdog, using preg_replace. I've tried something like /[^(dog|cat)]+/ but no success What should I do? Lot's of ways to skin this cat/dog. What's wrong with exploding the string using spaces and then walking the array looking for cat and dog while assembling the resultant string? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
2009/8/24 Ralph Deffke ralph_def...@yahoo.de typing error sorry forget my last post is there a was to destroy an object if there is hold a reference somewhere? Stuart stut...@gmail.com wrote in message news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com... 2009/8/24 kranthi kranthi...@gmail.com: unset($obj) always calls the __destruct() function of the class. in your case clearly you are missing something else. Probably unset($anobject) is not being called at all ? That's not entirely correct. PHP uses reference counting, so if unsetting a variable did not cause the object to be destructed then it's highly likely that there is another variable somewhere that is holding a reference to that object. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Then I assume you would have to copy the object into another variable rather than reference the one you are trying to destroy? -- Luke Slater :O) this text is protected by international copyright. it is illegal for anybody apart from the recipient to keep a copy of this text. dieser text wird von internationalem urheberrecht geschuetzt. allen ausser dem/der empfaenger/-in ist untersagt, eine kopie dieses textes zu behalten.
Re: [PHP] unset( $anobject) does not invoce __destruct()
this is also not the full truth try this and it works what are the circumstances that is causing this problem then, yes I do have distributed references over my script and there are clearly references still set, however after running the snipped script I can not see what I do special in my script causing the problem. I even tried with public and private static in other objects. it works. however the manual indicates the refernce counter has to be 0. ?php abstract class a { public function __construct(){ echo constructingbr; } public function __destruct(){ echo destructingbr; } } class b extends a{ } $c = new b(); $d = $c ; // works $f[] = $c ; // works class e { private $m; public function setM( $m ){ $this-m = $m; } } $o = new e(); $o-setM( $c ); // works unset( $c ); ? Lupus Michaelis mickael+...@lupusmic.org wrote in message news:41.f9.03363.01192...@pb1.pair.com... kranthi wrote: unset($obj) always calls the __destruct() function of the class. Never calls the dtor. The dtor will be called only when the reference count reaches 0. class c { function __destruct() { echo 'dying !' ; } } $v1 = new c ; $v2 = $v1 ; unset($v1) ; // don't call the dtor unset($v2) ; // call the dtor -- 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
RE: [PHP] SESSIONS lost sometimes
-Original Message- From: Nitebirdz [mailto:nitebi...@sacredchaos.com] Sent: 20 August 2009 02:58 PM To: php-general@lists.php.net Subject: Re: [PHP] SESSIONS lost sometimes On Thu, Aug 20, 2009 at 02:34:54PM +0200, Angelo Zanetti wrote: Hi Leon, No harm intended :) Just thought that people were missing my post now and only answering yours. Angelo, excuse me if I'm bringing up something very basic, but I'm new to this. Just trying to help. I imagine redirects couldn't be the cause of the problem, right? http://www.oscarm.org/news/detail/1877-avoiding_frustration_with_php_session s http://www.webmasterworld.com/forum88/8486.htm Hi thanks for the links it appears that its all in order also I'm not losing SESSIONS on the redirect but somewhere else. I have checked the garbage collection, disk space and other settings in the PHP.ini file. ALL FINE. So now I am really stuck and confused as to what could sometimes cause the loss of these variables and other times it just works fine. Is there possibly a way that I can call some function that will ensure that the sessions are saved (I checked the manual - nothing much). Any other ideas? Anything that you think might be causing issues? Thanks Angelo -- 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] Multiple EXEC() hang Apache
Hi all I'm upgrading PHP version from PHP 4 to 5.3.0 and Apache to 2.2.13, but I'm facing a weird problem on the following statement: $StringaParametri=exec('java -cp ..\\java rsa6230 ' . $Token); It works on PHP 4 and PHP 5 CGI, but it hang Apache using MOD_PHP5. The problem occurs when 2 or more requests are served at the same time. PHP 4 doesn't have the problem but it works as CGI. On PHP 5 we rule out CGI because it is too slow. The problem seems to be related to exec/system/ functions family. Other scripts using system(), running .NET program, hang in the same way. Configuration: Windows Server 2003 Apache 2.2.13 PHP 5.3.0 ( PHP 5.2.10 has the same problem too) Any idea? Thank you Darvin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
2009/8/24 Ralph Deffke ralph_def...@yahoo.de: this is also not the full truth try this and it works what are the circumstances that is causing this problem then, yes I do have distributed references over my script and there are clearly references still set, however after running the snipped script I can not see what I do special in my script causing the problem. I even tried with public and private static in other objects. it works. however the manual indicates the refernce counter has to be 0. Assuming you're using PHP 5... ?php abstract class a { public function __construct(){ echo constructingbr; } public function __destruct(){ echo destructingbr; } } class b extends a{ } $c = new b(); refcount = 1 $d = $c ; // works refcount = 2 $f[] = $c ; // works refcount = 3 class e { private $m; public function setM( $m ){ $this-m = $m; } } $o = new e(); $o-setM( $c ); // works refcount = 4 (due to assignment in setM) unset( $c ); refcount = 3 In PHP 5 all objects are passed by reference unless explicitly cloned. This means that assigning an object variable to another variable does nothing more than assign a reference and increment the referece count. What exactly in the manual leads you to believe that after the unset the refcount should be 0? -Stuart -- http://stut.net/ Lupus Michaelis mickael+...@lupusmic.org wrote in message news:41.f9.03363.01192...@pb1.pair.com... kranthi wrote: unset($obj) always calls the __destruct() function of the class. Never calls the dtor. The dtor will be called only when the reference count reaches 0. class c { function __destruct() { echo 'dying !' ; } } $v1 = new c ; $v2 = $v1 ; unset($v1) ; // don't call the dtor unset($v2) ; // call the dtor -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] inserting php value in html shorter wayand downloading winword mp3 files the fancy way
Hi, I am still a newbie in php. Is there a shorter way to include a php value in a form? input type=text name=fullname size=40 value=?php echo {$user['fullname']}; ? / is it possible to do smth like this ?=php {$user['fullname']}; ? like in JSP? Can I omit the last whitespace before the closing ? ? *** I tried to download the file from another server the fancy way in PHP, but it just display blank screen. Can You please look at my code: ?php $filepath = http://aa.yolasite.com/resources/happytears.doc;; // $filepath = http://users.skavt.net/~gleskovs/else/happytears.dochttp://users.skavt.net/%7Egleskovs/else/happytears.doc ; if (file_exists($filepath)) { header(Content-Type: application/force-download); header(Content-Disposition:filename=\happytears.doc\); $fd = fopen($filepath,'rb');//I tried also just 'r' and am not clear on which documents should I add b for binary? As I understand only text plain files and html files and php etc files are without 'b'. All documents, presentations, mp3 files, video files should have also 'b' for binary along r. Am I wrong? fpassthru($fd); fclose($fd); } ? Both filepaths are valid and accessible to the same document. I double checked them. Please help me. Thanks in advance, Yours, Grega -- Peace refuge: http://users.skavt.net/~gleskovs/http://users.skavt.net/%7Egleskovs/ When the sun rises I receive and when it sets I forgive;) Grega Leskovšek
Re: [PHP] inserting php value in html shorter wayand downloading winword mp3 files the fancy way
On Mon, 2009-08-24 at 17:56 +0200, Grega Leskovšek wrote: Hi, I am still a newbie in php. Is there a shorter way to include a php value in a form? input type=text name=fullname size=40 value=?php echo {$user['fullname']}; ? / is it possible to do smth like this ?=php {$user['fullname']}; ? like in JSP? Can I omit the last whitespace before the closing ? ? *** I tried to download the file from another server the fancy way in PHP, but it just display blank screen. Can You please look at my code: ?php $filepath = http://aa.yolasite.com/resources/happytears.doc;; // $filepath = http://users.skavt.net/~gleskovs/else/happytears.dochttp://users.skavt.net/%7Egleskovs/else/happytears.doc ; if (file_exists($filepath)) { header(Content-Type: application/force-download); header(Content-Disposition:filename=\happytears.doc\); $fd = fopen($filepath,'rb');//I tried also just 'r' and am not clear on which documents should I add b for binary? As I understand only text plain files and html files and php etc files are without 'b'. All documents, presentations, mp3 files, video files should have also 'b' for binary along r. Am I wrong? fpassthru($fd); fclose($fd); } ? Both filepaths are valid and accessible to the same document. I double checked them. Please help me. Thanks in advance, Yours, Grega -- Peace refuge: http://users.skavt.net/~gleskovs/http://users.skavt.net/%7Egleskovs/ When the sun rises I receive and when it sets I forgive;) Grega Leskovšek There is a shorttag syntax for a basic PHP echo, and you nearly had it in your code example: ?=$user['fullname']? But this will only work on a setup that has shorttags enabled, and a lot of shared hosts don't by default. Have you looked at heredoc? print EOC form input type=text name=fullname size=40 value={$user['fullname']}/ /form EOC; Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What if this code is right ? It worked perfectly for years!!
Hi, The code below actually takes input from a web form and sends the fields captured in an email. It used to work quite well since past few years. It has stopped now. I used Google's mail servers (google.com/a/website.com) ? $fName = $_REQUEST['fName'] ; $emailid = $_REQUEST['emailid'] ; $number = $_REQUEST['number'] ; $message = $_REQUEST['message'] ; mail( ch...@gmail.com, $number, $message, From: $emailid ); header( Location: http://www.thankyou.com/thankYouContact.php; ); ? This is the simplest one, how could it simply stop? Any help would be appreciated, I have already lost 148 queries that came through this form. Thanks in advance, Chris -- View this message in context: http://www.nabble.com/What-if-this-code-is-right---It-worked-perfectly-for-years%21%21-tp25118874p25118874.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
On Mon, 2009-08-24 at 09:12 -0700, Chris Carter wrote: Hi, The code below actually takes input from a web form and sends the fields captured in an email. It used to work quite well since past few years. It has stopped now. I used Google's mail servers (google.com/a/website.com) ? $fName = $_REQUEST['fName'] ; $emailid = $_REQUEST['emailid'] ; $number = $_REQUEST['number'] ; $message = $_REQUEST['message'] ; mail( ch...@gmail.com, $number, $message, From: $emailid ); header( Location: http://www.thankyou.com/thankYouContact.php; ); ? This is the simplest one, how could it simply stop? Any help would be appreciated, I have already lost 148 queries that came through this form. Thanks in advance, Chris -- View this message in context: http://www.nabble.com/What-if-this-code-is-right---It-worked-perfectly-for-years%21%21-tp25118874p25118874.html Sent from the PHP - General mailing list archive at Nabble.com. Have you tried it without the header redirect in there? There might be some sort of error message that you are never seeing because of that. Also, do you know for definite that the mail() function has stopped working? It could be that you are just not receiving the emails anymore due to some over zealous spam filter. Try sending the email to a variety of email accounts and see what happens. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
2009/8/24 Chris Carter chandan9sha...@yahoo.com: Hi, The code below actually takes input from a web form and sends the fields captured in an email. It used to work quite well since past few years. It has stopped now. I used Google's mail servers (google.com/a/website.com) ? $fName = $_REQUEST['fName'] ; $emailid = $_REQUEST['emailid'] ; $number = $_REQUEST['number'] ; $message = $_REQUEST['message'] ; mail( ch...@gmail.com, $number, $message, From: $emailid ); header( Location: http://www.thankyou.com/thankYouContact.php; ); ? This is the simplest one, how could it simply stop? Any help would be appreciated, I have already lost 148 queries that came through this form. Thanks in advance, Chris Hi Chris, More information would be very helpful. In exactly what way is it failing? Blank page? Apparently normal operation, except the email isn't being sent? Error messages? Log messages? etc. . . One possibility is that the server config has changed to no longer allow short open tags. This is easy to check for by simply replacing '?' with ?php' on the first line. There are of course other possibilities but without knowing how it's failing, any guesses would just be shots in the dark. Regards, Torben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
On Mon, Aug 24, 2009 at 09:12:19AM -0700, Chris Carter wrote: Hi, The code below actually takes input from a web form and sends the fields captured in an email. It used to work quite well since past few years. It has stopped now. I used Google's mail servers (google.com/a/website.com) ? $fName = $_REQUEST['fName'] ; $emailid = $_REQUEST['emailid'] ; $number = $_REQUEST['number'] ; $message = $_REQUEST['message'] ; mail( ch...@gmail.com, $number, $message, From: $emailid ); header( Location: http://www.thankyou.com/thankYouContact.php; ); ? This is the simplest one, how could it simply stop? Any help would be appreciated, I have already lost 148 queries that came through this form. As a test, change $_REQUEST above to $_POST (assuming POST method on the form), and try it. Also check the return value of the mail() function to see if it thinks it has succeeded or failed. If it fails, check the mail logs on the server to find what the mail server thinks is wrong. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What if this code is right ? It worked perfectly for years!!
You are absolutely right, more information is needed. Many ISP's are changing port number assignments on their SMTP outgoing email to prevent abuse. A simple change like that could cause the email to not go out, and it has nothing to do with PHP. Warren Vail Vail Systems Technology -Original Message- From: Lars Torben Wilson [mailto:larstor...@gmail.com] Sent: Monday, August 24, 2009 9:21 AM To: Chris Carter Cc: php-general@lists.php.net Subject: Re: [PHP] What if this code is right ? It worked perfectly for years!! 2009/8/24 Chris Carter chandan9sha...@yahoo.com: Hi, The code below actually takes input from a web form and sends the fields captured in an email. It used to work quite well since past few years. It has stopped now. I used Google's mail servers (google.com/a/website.com) ? $fName = $_REQUEST['fName'] ; $emailid = $_REQUEST['emailid'] ; $number = $_REQUEST['number'] ; $message = $_REQUEST['message'] ; mail( ch...@gmail.com, $number, $message, From: $emailid ); header( Location: http://www.thankyou.com/thankYouContact.php; ); ? This is the simplest one, how could it simply stop? Any help would be appreciated, I have already lost 148 queries that came through this form. Thanks in advance, Chris Hi Chris, More information would be very helpful. In exactly what way is it failing? Blank page? Apparently normal operation, except the email isn't being sent? Error messages? Log messages? etc. . . One possibility is that the server config has changed to no longer allow short open tags. This is easy to check for by simply replacing '?' with ?php' on the first line. There are of course other possibilities but without knowing how it's failing, any guesses would just be shots in the dark. Regards, Torben -- 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] inserting php value in html shorter wayand downloading winword mp3 files the fancy way
On Mon, Aug 24, 2009 at 05:56:46PM +0200, Grega Leskov??ek wrote: Hi, I am still a newbie in php. Is there a shorter way to include a php value in a form? input type=text name=fullname size=40 value=?php echo {$user['fullname']}; ? / is it possible to do smth like this ?=php {$user['fullname']}; ? like in JSP? Can I omit the last whitespace before the closing ? ? Yes, you can include a PHP value in a script. Like this: ...size=40 value=?php echo $user['fullname']; ? / Your curly braces are redundant, and you must quote the fullname index if you're not quoting the whole $user['fullname'] expression. Yes, you can remove the final space after $user['fullname']; and before the tag closure (?). But there's no reason to. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
On Mon, 2009-08-24 at 12:26 -0400, Paul M Foster wrote: On Mon, Aug 24, 2009 at 09:12:19AM -0700, Chris Carter wrote: Hi, The code below actually takes input from a web form and sends the fields captured in an email. It used to work quite well since past few years. It has stopped now. I used Google's mail servers (google.com/a/website.com) ? $fName = $_REQUEST['fName'] ; $emailid = $_REQUEST['emailid'] ; $number = $_REQUEST['number'] ; $message = $_REQUEST['message'] ; mail( ch...@gmail.com, $number, $message, From: $emailid ); header( Location: http://www.thankyou.com/thankYouContact.php; ); ? This is the simplest one, how could it simply stop? Any help would be appreciated, I have already lost 148 queries that came through this form. As a test, change $_REQUEST above to $_POST (assuming POST method on the form), and try it. Also check the return value of the mail() function to see if it thinks it has succeeded or failed. If it fails, check the mail logs on the server to find what the mail server thinks is wrong. Paul -- Paul M. Foster The $_REQUEST will not have anything to do with it. $_REQUEST contains any values sent by POST. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
Is there any alternative method to do this !!! Sending email through PHP? Paul M Foster wrote: On Mon, Aug 24, 2009 at 09:12:19AM -0700, Chris Carter wrote: Hi, The code below actually takes input from a web form and sends the fields captured in an email. It used to work quite well since past few years. It has stopped now. I used Google's mail servers (google.com/a/website.com) ? $fName = $_REQUEST['fName'] ; $emailid = $_REQUEST['emailid'] ; $number = $_REQUEST['number'] ; $message = $_REQUEST['message'] ; mail( ch...@gmail.com, $number, $message, From: $emailid ); header( Location: http://www.thankyou.com/thankYouContact.php; ); ? This is the simplest one, how could it simply stop? Any help would be appreciated, I have already lost 148 queries that came through this form. As a test, change $_REQUEST above to $_POST (assuming POST method on the form), and try it. Also check the return value of the mail() function to see if it thinks it has succeeded or failed. If it fails, check the mail logs on the server to find what the mail server thinks is wrong. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- View this message in context: http://www.nabble.com/What-if-this-code-is-right---It-worked-perfectly-for-years%21%21-tp25118874p25120282.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP pages won't open correctly on my server.
PHP pages won't open at all on my server. HTML pages open fine, but when going to the PHP pages that are on my server, the browser tries to download the page like a file instead of presenting it by the browser. What can I do to make the PHP processor to be handled properly? Do I need to recompile it again, and if so, what switches should I use? I am running Apache version 2.2.11. I'm on Fedora 2.6.11-1.1369_FC4 on that particular server. I'm running PHP 5.2.9 which I downloaded directly from the php web site, then untarred, ran make, and make install commands as described in the php INSTALL file that was included with the distribution.. == Example 2-4. Installation Instructions (Apache 2 Shared Module Version) 1. gzip -d httpd-2_0_NN.tar.gz 2. tar xvf httpd-2_0_NN.tar 3. gunzip php-NN.tar.gz 4. tar -xvf php-NN.tar 5. cd httpd-2_0_NN 6. ./configure --enable-so 7. make 8. make install == You will probably try to talk me into using yum, I would like to but it is broken and fixing it leads to even more troblemshooting. I want to fix this first, then I will tackle the yum issue next. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
see http://cn.php.net/manual/en/language.oop5.abstract.php PHP 5 introduces abstract classes and methods. It is not allowed to create an instance of a class that has been defined as abstract. Any class that contains at least one abstract method must also be abstract. Methods defined as abstract simply declare the method's signature they cannot define the implementation. You make misconception understand for abstract class,:(, correct code is: abstract class a { abstract public function __construct(){ } abstract public function __destruct(){ } } class b extends a{ public function __construct(){ echo constructingbr; } public function __destruct(){ echo destructingbr; } } $c = new b(); unset($c); if you want to make it work correctly that you want,plase change code to follow class c { public function __construct(){ echo constructingbr/; } public function __destruct(){ echo destructingbr/; } } class d extends c{ } $e = new d(); unset($e); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP pages won't open correctly on my server.
On Mon, Aug 24, 2009 at 01:30:00PM -0500, RRT wrote: PHP pages won't open at all on my server. HTML pages open fine, but when going to the PHP pages that are on my server, the browser tries to download the page like a file instead of presenting it by the browser. What can I do to make the PHP processor to be handled properly? Do I need to recompile it again, and if so, what switches should I use? I am running Apache version 2.2.11. I'm on Fedora 2.6.11-1.1369_FC4 on that particular server. I'm running PHP 5.2.9 which I downloaded directly from the php web site, then untarred, ran make, and make install commands as described in the php INSTALL file that was included with the distribution.. Hello, If PHP is installed properly, look at step 14 (loading the module in apache) and step 15 (Tell Apache to parse certain extensions as PHP) in the PHP installation documentation. http://www.php.net/manual/en/install.unix.apache2.php Regards, -- Ryan Cavicchioni -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
I dont agree, and as u see in my snipped code it works fine. in an abstract class u can define an implementation to define some basic things a overwriting function in an extending class has to take care of as well. this includes specialy magic functions. thats what they are made for. may be you talk about interfaces ? hack988 hack988 hack...@dev.htwap.com wrote in message news:4d03254c0908241122r5b6d1c3csc06ec475a0797...@mail.gmail.com... see http://cn.php.net/manual/en/language.oop5.abstract.php PHP 5 introduces abstract classes and methods. It is not allowed to create an instance of a class that has been defined as abstract. Any class that contains at least one abstract method must also be abstract. Methods defined as abstract simply declare the method's signature they cannot define the implementation. You make misconception understand for abstract class,:(, correct code is: abstract class a { abstract public function __construct(){ } abstract public function __destruct(){ } } class b extends a{ public function __construct(){ echo constructingbr; } public function __destruct(){ echo destructingbr; } } $c = new b(); unset($c); if you want to make it work correctly that you want,plase change code to follow class c { public function __construct(){ echo constructingbr/; } public function __destruct(){ echo destructingbr/; } } class d extends c{ } $e = new d(); unset($e); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
Stuart, u are right, the refcount in php 5 doesn't matter, where something left behind in my memory from earlier days, However i do have the effect that unsetting an object does NOT call __dectruct() ! but when the script ends it is called. this can be easily tested by putting a echo in destruct. my objects affected are pretty much the sheme I send. however I'm doing some reflection stuff in my classes. may be thats the reason. I will do some further investigation about that. Stuart stut...@gmail.com wrote in message news:a5f019de0908240749l8fa749s825cfa0e475f7...@mail.gmail.com... 2009/8/24 Ralph Deffke ralph_def...@yahoo.de: this is also not the full truth try this and it works what are the circumstances that is causing this problem then, yes I do have distributed references over my script and there are clearly references still set, however after running the snipped script I can not see what I do special in my script causing the problem. I even tried with public and private static in other objects. it works. however the manual indicates the refernce counter has to be 0. Assuming you're using PHP 5... ?php abstract class a { public function __construct(){ echo constructingbr; } public function __destruct(){ echo destructingbr; } } class b extends a{ } $c = new b(); refcount = 1 $d = $c ; // works refcount = 2 $f[] = $c ; // works refcount = 3 class e { private $m; public function setM( $m ){ $this-m = $m; } } $o = new e(); $o-setM( $c ); // works refcount = 4 (due to assignment in setM) unset( $c ); refcount = 3 In PHP 5 all objects are passed by reference unless explicitly cloned. This means that assigning an object variable to another variable does nothing more than assign a reference and increment the referece count. What exactly in the manual leads you to believe that after the unset the refcount should be 0? -Stuart -- http://stut.net/ Lupus Michaelis mickael+...@lupusmic.org wrote in message news:41.f9.03363.01192...@pb1.pair.com... kranthi wrote: unset($obj) always calls the __destruct() function of the class. Never calls the dtor. The dtor will be called only when the reference count reaches 0. class c { function __destruct() { echo 'dying !' ; } } $v1 = new c ; $v2 = $v1 ; unset($v1) ; // don't call the dtor unset($v2) ; // call the dtor -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php move_uploaded_file() filesize problem
Hi I have a problem with uploading files that are bigger than the Master Value allow me to, which is 32 MB. I've set the max_upload_filesize and max_post_size in a .htaccess file and the phpinfo() reports the new local value (128 MB) according to the .htaccess, but the script fails silently with no errors every time I try to upload a file greater than 32 MB. Have any of you had the same problem? Thanks! Thomas Gabrielsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
On Mon, Aug 24, 2009 at 10:37:11AM -0700, Chris Carter wrote: Is there any alternative method to do this !!! Sending email through PHP? Sure. You can use a class like PHPMailer rather than the built-in mail() function. But it's not going to matter if the problem is at the mail server, etc. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
2009/8/24 Paul M Foster pa...@quillandmouse.com: On Mon, Aug 24, 2009 at 10:37:11AM -0700, Chris Carter wrote: Is there any alternative method to do this !!! Sending email through PHP? Sure. You can use a class like PHPMailer rather than the built-in mail() function. But it's not going to matter if the problem is at the mail server, etc. Paul Agreed. Rather than just trying things willy-nilly, the OP should attempt to determine what the actual problem is. This gives a much greater chance of solving it. Torben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace anything that isn't WORD
Use preg_replace_callback instead! preg_replace_callback is better performance than preg_replace with /e. - code $str=cats i saw a cat and a dog; $str1=preg_replace_callback(/(dog|cat|.)/is,call_replace,$str); echo $str.BR/; echo $str1; function call_replace($match){ if(in_array($match[0],array('cat','dog'))) return $match[0]; else return ; } 2009/8/24 tedd tedd.sperl...@gmail.com: On Sat, Aug 22, 2009 at 12:32 PM, “•ÈýÏÝ“•ÂÔdanondan...@gmail.com wrote: Lets assume I have the string cats i saw a cat and a dog i want to strip everything except cat and dog so the result will be catcatdog, using preg_replace. I've tried something like /[^(dog|cat)]+/ but no success What should I do? Lot's of ways to skin this cat/dog. What's wrong with exploding the string using spaces and then walking the array looking for cat and dog while assembling the resultant string? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
i test your codes again,it is work correctly! But for backends compatibly with older php versions my codes is better :),i'm sorry for my mistake at moment. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unset() something that doesn't exist
is it the case that unset() does not trigger an error or throw an exception if it's argument was never set? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php move_uploaded_file() filesize problem
On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote: Hi I have a problem with uploading files that are bigger than the Master Value allow me to, which is 32 MB. I've set the max_upload_filesize and max_post_size in a .htaccess file and the phpinfo() reports the new local value (128 MB) according to the .htaccess, but the script fails silently with no errors every time I try to upload a file greater than 32 MB. Have any of you had the same problem? Hello, What is 'memory_limit' set at Regards, --Ryan Cavicchioni -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php move_uploaded_file() filesize problem
On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote: Hi I have a problem with uploading files that are bigger than the Master Value allow me to, which is 32 MB. I've set the max_upload_filesize and max_post_size in a .htaccess file and the phpinfo() reports the new local value (128 MB) according to the .htaccess, but the script fails silently with no errors every time I try to upload a file greater than 32 MB. Have any of you had the same problem? I stumbled across this blog post: http://www.gen-x-design.com/archives/uploading-large-files-with-php/ He suggests also looking at the script timeout and the 'max_input_time' ini setting. Regards, --Ryan Cavicchioni -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP pages won't open correctly on my server.
That link won't load for me. Did you get it to load OK for you? Ryan Cavicchioni r...@confabulator.net wrote in message news:20090824192749.ga13...@mail.confabulator.net... On Mon, Aug 24, 2009 at 01:30:00PM -0500, RRT wrote: PHP pages won't open at all on my server. HTML pages open fine, but when going to the PHP pages that are on my server, the browser tries to download the page like a file instead of presenting it by the browser. What can I do to make the PHP processor to be handled properly? Do I need to recompile it again, and if so, what switches should I use? I am running Apache version 2.2.11. I'm on Fedora 2.6.11-1.1369_FC4 on that particular server. I'm running PHP 5.2.9 which I downloaded directly from the php web site, then untarred, ran make, and make install commands as described in the php INSTALL file that was included with the distribution.. Hello, If PHP is installed properly, look at step 14 (loading the module in apache) and step 15 (Tell Apache to parse certain extensions as PHP) in the PHP installation documentation. http://www.php.net/manual/en/install.unix.apache2.php Regards, -- Ryan Cavicchioni -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php move_uploaded_file() filesize problem
Ryan Cavicchioni ryan...@confabulator.net wrote in message news:20090824205810.gc32...@mail.confabulator.net... On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote: Hi I have a problem with uploading files that are bigger than the Master Value allow me to, which is 32 MB. I've set the max_upload_filesize and max_post_size in a .htaccess file and the phpinfo() reports the new local value (128 MB) according to the .htaccess, but the script fails silently with no errors every time I try to upload a file greater than 32 MB. Have any of you had the same problem? I stumbled across this blog post: http://www.gen-x-design.com/archives/uploading-large-files-with-php/ He suggests also looking at the script timeout and the 'max_input_time' ini setting. Regards, --Ryan Cavicchioni Hi Ryan, and thanks for your reply: I've allready set that, but I forgot to mention it in the first post. This is what my .htaccess looks like: php_value upload_max_filesize 64M php_value max_execution_time 800 php_value post_max_size 64M php_value max_input_time 100 php_value memory_limit 120M I'm very sure that it has something to do with the upload_max_filesize because I generated two files, one just a little greater than 32MB, and one just a little bit smaller. The latter file is uploaded fine, but the bigger one is not. Thanks! Thomas Gabrielsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unset( $anobject) does not invoce __destruct()
Ashley Sheridan wrote: That would seem sensible to me though really. A constructor only bears true for the base class, so any classes which inherit it must incorporate all the constructor parts. A destructor doesn't know about further classes which will need to inherit it, so it shouldn't be inherited and the new class should sort things out. At least, that's how I see it. No, destructor can be set in abstract class. And it must if some advanced stuff done in the base classe. Like freeing ressources, closing file or database connections that is generic for classes that implements abstract stuff. So said, the __destuct destructor isn't called, for obvious reasons explained further. -- 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
Re: [PHP] php move_uploaded_file() filesize problem
I would also be shure that u run into the srcipt time out time. of course there is one limit u can be a little bit under or a little bit above. measure the time with microtime() and compare it with the script time out settings and u will have the answer ralph_def...@yahoo.de Thomas Gabrielsen tho...@arton.no wrote in message news:df.aa.03363.30213...@pb1.pair.com... Ryan Cavicchioni ryan...@confabulator.net wrote in message news:20090824205810.gc32...@mail.confabulator.net... On Mon, Aug 24, 2009 at 09:54:03PM +0200, Thomas Gabrielsen wrote: Hi I have a problem with uploading files that are bigger than the Master Value allow me to, which is 32 MB. I've set the max_upload_filesize and max_post_size in a .htaccess file and the phpinfo() reports the new local value (128 MB) according to the .htaccess, but the script fails silently with no errors every time I try to upload a file greater than 32 MB. Have any of you had the same problem? I stumbled across this blog post: http://www.gen-x-design.com/archives/uploading-large-files-with-php/ He suggests also looking at the script timeout and the 'max_input_time' ini setting. Regards, --Ryan Cavicchioni Hi Ryan, and thanks for your reply: I've allready set that, but I forgot to mention it in the first post. This is what my .htaccess looks like: php_value upload_max_filesize 64M php_value max_execution_time 800 php_value post_max_size 64M php_value max_input_time 100 php_value memory_limit 120M I'm very sure that it has something to do with the upload_max_filesize because I generated two files, one just a little greater than 32MB, and one just a little bit smaller. The latter file is uploaded fine, but the bigger one is not. Thanks! Thomas Gabrielsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DOMNode children iteration (was Re: array() returns something weird)
Hi Lars and list! New facts about the strange bug initially diagnosed as array() returning NULL: Firstly, the issue is not really about array() returning null, but about full blown UndefinedBehavior(TM) progressively trashing local variables. It just so happened that I noticed it first with a variable to which array() had been assigned just before things began breaking. Secondly, I proudly present the culprit: things break when I iterate over a DOMNode's children *by reference* using firstChild and nextSibling: for($child=$node-firstChild; $child; $child=$child-nextSibling) { //processing... } No problems if iteration is done by value or by DOMNodeList (childNodes, DOMXPath...). HOWEVER, I still consider this a bug because it destablizes PHP. After the evil loop has finished, things happen that should never happen, like a variable being NULL immediately after being assigned array(). I attach a demonstration. It is a self-contained commented script that you can execute from command line. Also attached is output on my machine. Best regards, Szczepan Hołyszewski attachment: testme.php THE GOOD WAY (DOMNodeList): Recursion structure: -render() -render() -render() - -render() - - - Transformation result: Some text. [object type='foo' name='bar'][param name='__default_content'] Some parameter text. Some parameter text. [object type='bar' name='nested'][param name='__default_content'] Some nested parameter text. Some nested parameter text. [object type='baz' name='deeply_nested'][param name='__default_content'] [/param][param name='bold']true[/param][/object] More nested parameter text More nested parameter text [/param][/object] [/param][/object] Some more text Success! THE MIXED WAY (DOMNodeList at outermost level, then firstChild/nextSibling by ref): Recursion structure: -render() -render() -render() - -render() - - - Transformation result: Some text. [object type='foo' name='bar'][param name='__default_content'] Some parameter text. Some parameter text. __default_content[param name='__default_content']__default_content[/param][/object] [/param][/object] Some more text Is it really a success? THE EVIL WAY (firstChild/nextSibling by ref): Recursion structure: -render() -render() -render() - -render() - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unset() something that doesn't exist
causes an error Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in C:\wamp\www\TinyCreator\testCrapp6.php on line 42 Tom Worster f...@thefsb.org wrote in message news:c6b87877.11463%...@thefsb.org... is it the case that unset() does not trigger an error or throw an exception if it's argument was never set? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] __destruct() not called ! we shot us in the foot try the script
well I would call this an error in the first view , and some of u where right! and the stuff with the refernce counter seems to be right as well. however I can't see a reason for it as 5.x works through refernces. so unsetting a REFERENCE to the object does not destroy it. How to destroy the object then? ?php abstract class a { public function __construct(){ echo constructingbr; } public function __destruct(){ echo destructingbr; } } class b extends a{ public function doSomething(){ echo I'm doing ...but the reference c to the object is unset()br; } } $c = new b(); $d = $c ; // works $f[] = $c ; // works class e { public static $m; public static function setM( $m ){ self::$m = $m; } } $o = new e(); e::setM( $c ); // works echo unsetting ...br; unset( $c ); $d-doSomething(); echo script ending now ...br; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unset( $anobject) does not invoce __destruct()
I did start a new topic have a look there; Ralph Deffke ralph_def...@yahoo.de wrote in message news:79.73.03363.43752...@pb1.pair.com... but it should? shouldn't it how can I destroy a class instance invocing __detruct() of the class ?!?!? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] __destruct() not called ! we shot us in the foot try the script
Ralph Deffke wrote: Sorry to bring it to this thread, but could you respond to Ashley in the [PHP] wierd behavior on parsing css with no php included thread. We would like the solution place in the archives to future visitor benefit. Thanks Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there limitation for switch case: argument's value?
Oh I see. I missed out one thing too. There is no need to put the same code under both case 7 6 separately, but just under case 6 will do. This is simpler in fact! Thanks Tedd and Torben! I'll fix to this style from now onwards. tedd tedd.sperl...@gmail.com wrote in message news:p06240800c6b84328c...@[192.168.1.100]... At 9:44 PM -0700 8/22/09, Lars Torben Wilson wrote: Hi Keith, Glad it works! I'm not sure how inverting the case statement helps you minimize the code in each case. As both I and Adam showed, you can do the same thing more efficiently (and IMHO much more readably) like this: switch ($sum) { case 8: break; case 7: case 6: break; case 2: case 1: break; case 0: break; default: break; } Additionally, I would argue there's nothing different below other than it's even more easier to read and understand: switch ($sum) { case 0: break; case 1: case 2: break; case 6: case 7: break; case 8: break; default: break; } Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Shopping Cart Recommendation
The only e-commerce site I've worked on was based on OSCommerce. It's pretty good, easy to integrate new functionality into, and not too much trouble to style up to look the way you want with CSS. Thanks, Ash. I downloaded CRE Loaded, which is an off-shoot of osCommerce, and the latest version looks pretty nice. I'm digging in to the PHP code to see what that's like. I'm also looking at Magento. That may be more than what we need, but it's getting rave reviews. I can't wait to go 100% PHP on our site! Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unset() something that doesn't exist
Ralph Deffke wrote: causes an error Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'$'' in C:\wamp\www\TinyCreator\testCrapp6.php on line 42 Tom Worster f...@thefsb.org wrote in message news:c6b87877.11463%...@thefsb.org... is it the case that unset() does not trigger an error or throw an exception if it's argument was never set? What!?!? No, It does not cause an error, not even a notice. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace anything that isn't WORD
hack988 hack988 wrote: Use preg_replace_callback instead! preg_replace_callback is better performance than preg_replace with /e. - code $str=cats i saw a cat and a dog; $str1=preg_replace_callback(/(dog|cat|.)/is,call_replace,$str); echo $str.BR/; echo $str1; function call_replace($match){ if(in_array($match[0],array('cat','dog'))) return $match[0]; else return ; } 2009/8/24 tedd tedd.sperl...@gmail.com: On Sat, Aug 22, 2009 at 12:32 PM, “•ÈýÏÝ“•ÂÔdanondan...@gmail.com wrote: Lets assume I have the string cats i saw a cat and a dog i want to strip everything except cat and dog so the result will be catcatdog, using preg_replace. I've tried something like /[^(dog|cat)]+/ but no success What should I do? Lot's of ways to skin this cat/dog. What's wrong with exploding the string using spaces and then walking the array looking for cat and dog while assembling the resultant string? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Certain posts of mine seem to get sucked into a black hole and I never see theme. Maybe because I use this list as a newsgroup? Anyway, what I posted before: Match everything but only replace the backreference for the words: $s = cats i saw a cat and a dog; $r = preg_replace('#.*?(cat|dog).*?#', '\1', $s); -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace anything that isn't WORD
For the record Shawn: I received your previous post from Aug 22 and I think that it is the best solution. Jonathan On Tue, Aug 25, 2009 at 12:41 AM, Shawn McKenzienos...@mckenzies.net wrote: hack988 hack988 wrote: Use preg_replace_callback instead! preg_replace_callback is better performance than preg_replace with /e. - code $str=cats i saw a cat and a dog; $str1=preg_replace_callback(/(dog|cat|.)/is,call_replace,$str); echo $str.BR/; echo $str1; function call_replace($match){ if(in_array($match[0],array('cat','dog'))) return $match[0]; else return ; } 2009/8/24 tedd tedd.sperl...@gmail.com: On Sat, Aug 22, 2009 at 12:32 PM, “•ÈýÏÝ“•ÂÔdanondan...@gmail.com wrote: Lets assume I have the string cats i saw a cat and a dog i want to strip everything except cat and dog so the result will be catcatdog, using preg_replace. I've tried something like /[^(dog|cat)]+/ but no success What should I do? Lot's of ways to skin this cat/dog. What's wrong with exploding the string using spaces and then walking the array looking for cat and dog while assembling the resultant string? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Certain posts of mine seem to get sucked into a black hole and I never see theme. Maybe because I use this list as a newsgroup? Anyway, what I posted before: Match everything but only replace the backreference for the words: $s = cats i saw a cat and a dog; $r = preg_replace('#.*?(cat|dog).*?#', '\1', $s); -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] security question of ZCE exam
Hi all, i'm discutting with my friend about this question for 30 min and i do not agree with he. Here is the question: Why is it important from a security perspective to never display PHP error messages directly to the end user, yet always log them? Answers: (choose 2) Error messages will contain sensitive session information Error messages can contain cross site scripting attacks Security risks involved in logging are handled by PHP XError messages give the perception of insecurity to the user XError messages can contain data useful to a potential attacker My answers is marked with a X. some clue about this? thanks Augusto Morais