php-general Digest 23 Feb 2012 09:15:52 -0000 Issue 7699 Topics (messages 316760 through 316763):
Re: SimpleXML and the Single String (SOLVED) 316760 by: Jay Blanchard 316761 by: Marco Behnke 316762 by: Jay Blanchard PHP-FPM security.limit_extensions 316763 by: Paspao 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 ----------------------------------------------------------------------
--- Begin Message ---On 2/22/2012 8:32 AM, ma...@behnke.biz wrote:I don't really see a need to add an extra layer or class extension when casting works fine. Am I wrong? Why add several lines of code in an extension class?There is another nice way. You can pass a second value to the simple xml constructor which is a class name to be used instead of SimpleXMLElement. You can write your own class that extends SimpleXMLElement and override the magic methods to skip the casting
--- End Message ---
--- Begin Message ---Am 22.02.12 16:04, schrieb Jay Blanchard: > On 2/22/2012 8:32 AM, ma...@behnke.biz wrote: >> There is another nice way. >> You can pass a second value to the simple xml constructor which is a >> class >> name to be used instead of SimpleXMLElement. >> You can write your own class that extends SimpleXMLElement and >> override the >> magic methods to skip the casting >> > I don't really see a need to add an extra layer or class extension > when casting works fine. Am I wrong? Why add several lines of code in > an extension class? > To keep the code readable? $value = $xml->node; vs. $value = (String)$xml->node; I like the first one. Plus you handle it to dynamically to the right type function __get($value) { if is float return float casted value if is boolean ... and so on } -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.bizsignature.asc
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message --->> I don't really see a need to add an extra layer or class extension >> when casting works fine. Am I wrong? Why add several lines of code in >> an extension class? >> > To keep the code readable? > > $value = $xml->node; > > vs. > > $value = (String)$xml->node; > > I like the first one. Plus you handle it to dynamically to the right type > > function __get($value) > { > if is float return float casted value > if is boolean ... > and so on > } The code is no less readable my way, YMMV
--- End Message ---
--- Begin Message ---Hello , I need to parse PHP files with no extension , I was getting access denied error than I discovered that it was cause by security.limit_extensions option in PHP-FPM config file. I tried to add the script name (testscript) to the configuration file and now it works: security.limit_extensions = .php .php3 .php4 .php5 testscript I do not want to add all filenames and then restart php-fpm each time, is there a way to parse all file without extension or a wildcard to put in configuration? Thank you P.
--- End Message ---