php-general Digest 29 Feb 2012 08:29:07 -0000 Issue 7706
php-general Digest 29 Feb 2012 08:29:07 - Issue 7706 Topics (messages 316789 through 316797): Re: Insert new array after specific key in multidimensional array 316789 by: Micky Hulse 316790 by: Adam Richardson 316791 by: Micky Hulse How do I enable more useful PHP error logging? 316792 by: Daevid Vincent 316793 by: Adam Richardson 316794 by: Stuart Dallas 316795 by: Daevid Vincent 316796 by: Tommy Pham 316797 by: Simon Schick 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--- On Tue, Feb 28, 2012 at 8:36 AM, Shawn McKenzie nos...@mckenzies.net wrote: Might be an easier way but this should work. You can sort the $before = true out for yourself :-) Hi Shawn, I've updated your function to do the $before bit: https://gist.github.com/1928452#file_array_insert.php I also set it up to merge the new array to the end if the key does not exist. Out of all the examples I have found, your approach looks the cleanest and the most compact. I'm open to feedback. Many thanks Cheers, M ---End Message--- ---BeginMessage--- On Mon, Feb 27, 2012 at 9:12 PM, Micky Hulse mickyhulse.li...@gmail.comwrote: Howdy! Example code: https://gist.github.com/1928452 What would be the best way to insert $o_insert array into $o array after specified key? I hate to just ask for example code, but I can't seem to find the perfect solution. :( Many thanks in advance for the help! Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Out of curiosity, why are you worried about the order of elements in an associative array? Thanks, Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com ---End Message--- ---BeginMessage--- Hi Adam! On Tue, Feb 28, 2012 at 2:05 PM, Adam Richardson simples...@gmail.com wrote: What would be the best way to insert $o_insert array into $o array after specified key? Great question. :D Quick answer: It's a Wordpress thang! Long answer: I am working with WordPress and the theme that I am using stores all of its settings in a multidimensional array... The WP admin displays the contents of the array as a GUI and the order of the array is what dictates the display order. ---End Message--- ---BeginMessage--- My question is, is there a way to enable some PHP configuration that would output more verbose information, such as a backtrace or the URL attempted? In our PHP error log, we have the usual semi-useful information. However this is only a partial story as it's hard to re-create the URL that caused the error. In the first Actor example, yeah actor_id 2206 doesn't exist and so now I have put a try/catch on all pages that have new Actor($actor_id) but it doesn't tell me WHY this is happening. How did someone get to this point? I doubt they just randomly picked '2206' which happens to be one of only a handful of actually missing actors out of 100k. Sure I guess it could be a bot that sequentially tried them all, but this is not likely since we have SEO style URLs and so we re-map an actor name back to the ID. So the bot would have to try NAMEs not IDs. This means we must have some link somewhere that points to this. Same with the common foreach() warnings below. Yeah, the array being passed is empty/null. Sure I can check the array before doing the foreach() or even @foreach() but that doesn't tell me the root cause. What video are they trying to access that has no scenes or invalid actors? We do NOT have apache logging turned on as we get 30,000 hits per second and it would be too expensive. I only care about PHP errors like this. And the apache error log (which we do have enabled) doesn't have useful info related to these kinds of issues as they're really not apache's problem. That log only deals with missing files/images/pages/etc. [28-Feb-2012 13:43:19 UTC] PHP Fatal error: Uncaught exception 'ObjectNotFound' with message 'There is no such object Actor [2206].' in /home/SHARED/classes/base.class.php:103 Stack trace: #0 /home/SHARED/classes/actor.class.php(61): Base-load_from_sql() #1 /home/m.videosz.com/browse_scenes.php(89): Actor-__construct(2206) #2 {main} thrown in /home/SHARED/classes/base.class.php on line 103 [28-Feb-2012 10:54:01 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/m.dev.com/scene.php on line 138 [28-Feb-2012 07:22:50 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/SHARED/classes/scene.class.php on line 423 ---End Message--- ---BeginMessage--- On Tue, Feb 28, 2012 at 6:14 PM, Daevid Vincent dae...@daevid.com wrote:
php-general Digest 1 Mar 2012 03:06:24 -0000 Issue 7707
php-general Digest 1 Mar 2012 03:06:24 - Issue 7707 Topics (messages 316798 through 316815): Roller - A High Performance Router for PHP5.3 and PHP5.4 316798 by: Lin Yo-An Custom PHP extension: Invalid library (maybe not a PHP library) 316799 by: S³awomir Zborowski 316802 by: Matijn Woudt 316803 by: S³awomir Zborowski Custom PHP extension - Invalid library (maybe not a PHP library) 316800 by: S³awomir Zborowski Re: How do I enable more useful PHP error logging? 316801 by: Stuart Dallas Little Info... 316804 by: Don Wieland 316805 by: Daniel Brown 316807 by: Matijn Woudt 316809 by: Ashley Sheridan Website preview script 316806 by: Nibin V M 316808 by: Matijn Woudt 316810 by: Ashley Sheridan 316811 by: Nibin V M 316812 by: Simon Schick 316813 by: Ashley Sheridan 316814 by: Simon Schick 316815 by: Nibin V M 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--- Hi folks, we have working on a PHP router project for a while, now we have a final stable release for this. Roller - high performance router for PHP5.3+ https://github.com/c9s/Roller And we wrote an extension for dispatching routes, by using this extension, the dispatch performance is faster 1607% than original PHP version. (extension is optional). RESTful support, you can easily define RESTful paths for records. Features: - Highly customizable - Flexible - APC cache support. - File cache support. - Built-in *RESTful* route generator, resource handler. - Customizable RESTful route generator, resource handler. - Simple, Useful route path syntax. (rails-style) - High performance (through PHP extension, can dispatch *1607%* faster than pure php version) - High unit test coverage, coverage *88%*. -- Best Regards, c9s@github - Onion project (PHP package builder): http://github.com/c9s/Onion ---End Message--- ---BeginMessage--- Hi all! I'm interested in creating a custom PHP extension. I have found several so called tutorials, but the code examples they contain do not work for me. Let's stick to this site: http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/ Basing on it I have following sources: # config.m4: PHP_ARG_ENABLE(hello2,whether to enable hello2 support, [ --enable-hello2Enable hello2 support]) if test $PHP_HELLO2 = yes; then AC_DEFINE(HAVE_HELLO2,1,[Whether you want hello2 support]) PHP_NEW_EXTENSION(hello2, php_hello2.c, $ext_shared) fi # # php_hello2.h: #ifndef PHP_HELLO2_H #define PHP_HELLO2_H 1 #define PHP_HELLO_WORLD_VERSION 1.0 #define PHP_HELLO_WORLD_EXTNAME hello2 PHP_FUNCTION(hello_world); extern zend_module_entry hello2_module_entry; #define phpext_hello2_ptr hello2_module_entry #endif # # php_hello2.c: #ifdef HAVE_CONFIG_H #include config.h #endif #include php.h #include php_hello2.h static function_entry hello2_functions[] = { PHP_FE(hello_world, NULL) {NULL, NULL, NULL} }; zend_module_entry hello2_module_entry = { #if ZEND_MODULE_API_NO = 20010901 STANDARD_MODULE_HEADER, #endif PHP_HELLO_WORLD_EXTNAME, hello2_functions, NULL, NULL, NULL, NULL, NULL, #if ZEND_MODULE_API_NO = 20010901 PHP_HELLO_WORLD_VERSION, #endif STANDARD_MODULE_PROPERTIES }; #ifdef COMPILE_DL_HELLO2 ZEND_GET_MODULE(hello2) #endif PHP_FUNCTION(hello_world) { RETURN_STRING(Hello World, 1); } # The code compiles well with these commands: $ ./configure --enable-hello2 $ make -j5 # make install But after I execute the command: $ php5 -dextension=hello2.so -v I get the following output. PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'hello2.so' in Unknown on line 0 What I am missing here? Can someone help me? Thanks in advance. Kind Regards, Sławomir ---End Message--- ---BeginMessage--- The code compiles well with these commands: $ ./configure --enable-hello2 $ make -j5 # make install It's a long time since I built PHP extensions, but aren't you supposed to run phpize before configure? But after I execute the command: $ php5 -dextension=hello2.so -v I get the following output. PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'hello2.so' in Unknown on line 0 What I am missing here? Can someone help me? Thanks in advance. Have you tried google? I found this comment on the PHP sites[1], and it says that the module didn't work when copied into the apache directory, but make install