php-general Digest 21 Mar 2012 14:27:13 -0000 Issue 7737
php-general Digest 21 Mar 2012 14:27:13 - Issue 7737 Topics (messages 317152 through 317159): Re: Bug zlib.output_compression not normal work in IIS7.5 317152 by: Simon Schick Pear Auth problem 317153 by: Karl-Arne Gjersøyen 317159 by: Govinda How can I convert these to hex or strings? 317154 by: David OBrien 317155 by: Jim Giner 317156 by: David OBrien 317157 by: Jim Giner Re: php upload does not work proper, [tmp_name] and other are missing in $_FILES 317158 by: Meike Stone 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--- 2012/3/19 小鱼虾 i...@xiaoyu.org How I do fix it ? https://bugs.php.net/bug.php?id=61434 Hi, I got a rough overview of the conversation in the bug-tracker ... You were always talking about a tool you used to test the gzip-compression ... but why not test it natively? Using Firefox (with the extension Firebug) or Safari / Chrome for example you can easily view the respond-header from the server and get more info out of that. Just press F12, click on the network-tab, select your request and search in the response-header for Content-Encoding: ... I would write my own small php-test-script where you just output some text. Then you're sure that not other code is doing something strange. Another possible problem: Is the extension zlib enabled at all? The documentation says that it's disabled by default ... http://www.php.net/manual/en/zlib.installation.php Bye Simon ---End Message--- ---BeginMessage--- Hello. I am trying to use pear Auth packet but am doing something wrong. I am currently looking at the simple example in the documentation, but something is wrong in my source code, because if I write a username and a password in the fields and hit the submit button, I receive a blank pages without any informatio at all.. Here is my source code: --- ?php require_once('Auth.php'); if(!isset($_POST['submit'])){ function loginFunction($username = null, $status = null, $auth = null){ ? form action=index.php method=post fieldset legendLogin:/legend p label for=usernameUsername:/labelbr input id=username name=username type=text /p p label for=passwordPassword:/labelbr input id=password name=password type=password /p p input id=submit name=submit type=submit value=Login /p /fieldset /form ?php } $options = array( 'dsn' = mysql://username:password@localhost/database, ); $a = new Auth(DB, $options, loginFunction); $a-start(); if($a-checkAuth()){ header(Location: http://www.karl-arne.name/;); } } ? The example is located at: http://pear.php.net/manual/en/package.authentication.auth.intro.php Thanks for your time. Karl ---End Message--- ---BeginMessage--- Hello. I am trying to use pear Auth packet but am doing something wrong. I am currently looking at the simple example in the documentation, but something is wrong in my source code, because if I write a username and a password in the fields and hit the submit button, I receive a blank pages without any informatio at all.. Here is my source code: --- ?php require_once('Auth.php'); if(!isset($_POST['submit'])){ function loginFunction($username = null, $status = null, $auth = null){ ? form action=index.php method=post fieldset legendLogin:/legend p label for=usernameUsername:/labelbr input id=username name=username type=text /p p label for=passwordPassword:/labelbr input id=password name=password type=password /p p input id=submit name=submit type=submit value=Login /p /fieldset /form ?php } $options = array( 'dsn' = mysql://username:password@localhost/database, ); $a = new Auth(DB, $options, loginFunction); $a-start(); if($a-checkAuth()){ header(Location: http://www.karl-arne.name/;); } } ? The example is located at: http://pear.php.net/manual/en/package.authentication.auth.intro.php Karl, You'll want to turn on error reporting so you can start to get a peak into what is happening.. Do you know how to do that? (... so that you get more info. than just a blank page). -Govinda ---End Message--- ---BeginMessage--- I'm running snmp against a huge list of printers and certain HP models return Model: stdClass Object ( [type] = 4 [value] = ☺§HP LaserJet P3010 Series ) Serial: stdClass Object ( [type] = 4
php-general Digest 22 Mar 2012 05:56:41 -0000 Issue 7738
php-general Digest 22 Mar 2012 05:56:41 - Issue 7738 Topics (messages 317160 through 317171): Re: php upload does not work proper, [tmp_name] and other are missing in $_FILES 317160 by: Meike Stone 317162 by: Matijn Woudt PEAR_Error reporting 317161 by: Karl-Arne Gjersøyen Thinking out loud - a continuation... 317163 by: Jay Blanchard 317164 by: Adam Richardson 317165 by: Daniel Brown 317166 by: Jay Blanchard 317167 by: Robert Cummings 317168 by: Jay Blanchard 317169 by: Jim Lucas 317171 by: Robert Cummings Node.PHP 317170 by: Joseph Moniz 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 what is the reason, that the module not work properly? Which next step can I do? I figured out, that the new mod_php5.so is not linked against libmm.so.14. Can this be the problem? Thanks Meike # ldd mod_php5.so.5.3.8 linux-vdso.so.1 = (0x7fffe051c000) libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f3d30f82000) libresolv.so.2 = /lib64/libresolv.so.2 (0x7f3d30d6b000) libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f3d30b3a000) librt.so.1 = /lib64/librt.so.1 (0x7f3d30931000) libm.so.6 = /lib64/libm.so.6 (0x7f3d306b8000) libdl.so.2 = /lib64/libdl.so.2 (0x7f3d304b3000) libnsl.so.1 = /lib64/libnsl.so.1 (0x7f3d3029b000) libz.so.1 = /lib64/libz.so.1 (0x7f3d30085000) libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f3d2fd28000) libc.so.6 = /lib64/libc.so.6 (0x7f3d2f9b4000) libpthread.so.0 = /lib64/libpthread.so.0 (0x7f3d2f797000) /lib64/ld-linux-x86-64.so.2 (0x7f3d31c0f000) # ldd mod_php5.so.5.2.14 linux-vdso.so.1 = (0x7fffcdfff000) libmm.so.14 = /usr/lib64/libmm.so.14 (0x7f0307223000) libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f0307428000) libresolv.so.2 = /lib64/libresolv.so.2 (0x7f0306bd2000) libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f0306ff2000) librt.so.1 = /lib64/librt.so.1 (0x7f0306de9000) libm.so.6 = /lib64/libm.so.6 (0x7f0306958000) libdl.so.2 = /lib64/libdl.so.2 (0x7f0306754000) libnsl.so.1 = /lib64/libnsl.so.1 (0x7f030653c000) libz.so.1 = /lib64/libz.so.1 (0x7f0306325000) libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f0305fc9000) libc.so.6 = /lib64/libc.so.6 (0x7f0305c55000) libpthread.so.0 = /lib64/libpthread.so.0 (0x7f0305a37000) /lib64/ld-linux-x86-64.so.2 (0x7f0307b51000) ---End Message--- ---BeginMessage--- On Wed, Mar 21, 2012 at 3:32 PM, Meike Stone meike.st...@googlemail.com wrote: But what is the reason, that the module not work properly? Which next step can I do? I figured out, that the new mod_php5.so is not linked against libmm.so.14. Can this be the problem? Thanks Meike # ldd mod_php5.so.5.3.8 linux-vdso.so.1 = (0x7fffe051c000) libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f3d30f82000) libresolv.so.2 = /lib64/libresolv.so.2 (0x7f3d30d6b000) libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f3d30b3a000) librt.so.1 = /lib64/librt.so.1 (0x7f3d30931000) libm.so.6 = /lib64/libm.so.6 (0x7f3d306b8000) libdl.so.2 = /lib64/libdl.so.2 (0x7f3d304b3000) libnsl.so.1 = /lib64/libnsl.so.1 (0x7f3d3029b000) libz.so.1 = /lib64/libz.so.1 (0x7f3d30085000) libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f3d2fd28000) libc.so.6 = /lib64/libc.so.6 (0x7f3d2f9b4000) libpthread.so.0 = /lib64/libpthread.so.0 (0x7f3d2f797000) /lib64/ld-linux-x86-64.so.2 (0x7f3d31c0f000) # ldd mod_php5.so.5.2.14 linux-vdso.so.1 = (0x7fffcdfff000) libmm.so.14 = /usr/lib64/libmm.so.14 (0x7f0307223000) libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f0307428000) libresolv.so.2 = /lib64/libresolv.so.2 (0x7f0306bd2000) libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f0306ff2000) librt.so.1 = /lib64/librt.so.1 (0x7f0306de9000) libm.so.6 = /lib64/libm.so.6 (0x7f0306958000) libdl.so.2 = /lib64/libdl.so.2 (0x7f0306754000) libnsl.so.1 = /lib64/libnsl.so.1 (0x7f030653c000) libz.so.1 = /lib64/libz.so.1 (0x7f0306325000) libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f0305fc9000) libc.so.6 = /lib64/libc.so.6 (0x7f0305c55000) libpthread.so.0 = /lib64/libpthread.so.0 (0x7f0305a37000) /lib64/ld-linux-x86-64.so.2 (0x7f0307b51000) I believe using
Re: [PHP] Bug zlib.output_compression not normal work in IIS7.5
2012/3/19 小鱼虾 i...@xiaoyu.org How I do fix it ? https://bugs.php.net/bug.php?id=61434 Hi, I got a rough overview of the conversation in the bug-tracker ... You were always talking about a tool you used to test the gzip-compression ... but why not test it natively? Using Firefox (with the extension Firebug) or Safari / Chrome for example you can easily view the respond-header from the server and get more info out of that. Just press F12, click on the network-tab, select your request and search in the response-header for Content-Encoding: ... I would write my own small php-test-script where you just output some text. Then you're sure that not other code is doing something strange. Another possible problem: Is the extension zlib enabled at all? The documentation says that it's disabled by default ... http://www.php.net/manual/en/zlib.installation.php Bye Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pear Auth problem
Hello. I am trying to use pear Auth packet but am doing something wrong. I am currently looking at the simple example in the documentation, but something is wrong in my source code, because if I write a username and a password in the fields and hit the submit button, I receive a blank pages without any informatio at all.. Here is my source code: --- ?php require_once('Auth.php'); if(!isset($_POST['submit'])){ function loginFunction($username = null, $status = null, $auth = null){ ? form action=index.php method=post fieldset legendLogin:/legend p label for=usernameUsername:/labelbr input id=username name=username type=text /p p label for=passwordPassword:/labelbr input id=password name=password type=password /p p input id=submit name=submit type=submit value=Login /p /fieldset /form ?php } $options = array( 'dsn' = mysql://username:password@localhost/database, ); $a = new Auth(DB, $options, loginFunction); $a-start(); if($a-checkAuth()){ header(Location: http://www.karl-arne.name/;); } } ? The example is located at: http://pear.php.net/manual/en/package.authentication.auth.intro.php Thanks for your time. Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can I convert these to hex or strings?
I'm running snmp against a huge list of printers and certain HP models return Model: stdClass Object ( [type] = 4 [value] = ☺§HP LaserJet P3010 Series ) Serial: stdClass Object ( [type] = 4 [value] = ☺§VNBCC1917W ) MacAddress: stdClass Object ( [type] = 4 [value] = ⌠╬F╒' ) I just strip the weird ones off the model and serial entries but I've been pulling my hair out trying to convert the macaddress one to a hex string or just a string Can some one educate me or point me in the right direction? David OBrien
[PHP] Re: How can I convert these to hex or strings?
Did you do a search of the php manual? I did one on hex and found function bin2hex. Not sure how you mac address is actually built, but I would try converting it char by char and see what the function returns. Or maybe just pass the whole string to it. Just a guess. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How can I convert these to hex or strings?
Damn I'm an idiot... sorry :\ On Wed, Mar 21, 2012 at 9:34 AM, Jim Giner jim.gi...@albanyhandball.comwrote: Did you do a search of the php manual? I did one on hex and found function bin2hex. Not sure how you mac address is actually built, but I would try converting it char by char and see what the function returns. Or maybe just pass the whole string to it. Just a guess. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How can I convert these to hex or strings?
Not until you find out if it actually works. Then, maybe David OBrien dgobr...@gmail.com wrote in message news:CAF=yd_3rbr-gkonpjdbtogssiufwzeqteanqneproh6hhyu...@mail.gmail.com... Damn I'm an idiot... sorry :\ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php upload does not work proper, [tmp_name] and other are missing in $_FILES
2012/3/20 Meike Stone meike.st...@googlemail.com: First of all, check your apache log files for any hints. There's probably a warning/error in there that explains why. I switched to LogLevel debug but in error_log is nothing found, the access_log showes only: 192.168.1.89 - - [20/Mar/2012:16:43:53 +0100] POST /i3.php HTTP/1.1 200 539 http://172.16.1.170/i3.php; Mozilla/5.0 (Windows NT 5.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0 If not, check your php.ini settings, there are a few settings that can affect uploads (see [1]). [1] http://nl3.php.net/manual/en/ini.core.php#ini.sect.file-uploads Yes, I know this settings and checked this and disabled suhosin too. Nothing helped. I did this before stracing ... Thanks Meike I investigated a little bit more and found, that if I only swapped the Apache php module (moved away the original /usr/lib64/apache2/mod_php5.so and placed one from 5.2.14) from php 5.2.14, all works, same configuration! So it should not a problem of the configuration. But what is the reason, that the module not work properly? Which next step can I do? Thanks Meike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pear Auth problem
Hello. I am trying to use pear Auth packet but am doing something wrong. I am currently looking at the simple example in the documentation, but something is wrong in my source code, because if I write a username and a password in the fields and hit the submit button, I receive a blank pages without any informatio at all.. Here is my source code: --- ?php require_once('Auth.php'); if(!isset($_POST['submit'])){ function loginFunction($username = null, $status = null, $auth = null){ ? form action=index.php method=post fieldset legendLogin:/legend p label for=usernameUsername:/labelbr input id=username name=username type=text /p p label for=passwordPassword:/labelbr input id=password name=password type=password /p p input id=submit name=submit type=submit value=Login /p /fieldset /form ?php } $options = array( 'dsn' = mysql://username:password@localhost/database, ); $a = new Auth(DB, $options, loginFunction); $a-start(); if($a-checkAuth()){ header(Location: http://www.karl-arne.name/;); } } ? The example is located at: http://pear.php.net/manual/en/package.authentication.auth.intro.php Karl, You'll want to turn on error reporting so you can start to get a peak into what is happening.. Do you know how to do that? (... so that you get more info. than just a blank page). -Govinda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php upload does not work proper, [tmp_name] and other are missing in $_FILES
But what is the reason, that the module not work properly? Which next step can I do? I figured out, that the new mod_php5.so is not linked against libmm.so.14. Can this be the problem? Thanks Meike # ldd mod_php5.so.5.3.8 linux-vdso.so.1 = (0x7fffe051c000) libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f3d30f82000) libresolv.so.2 = /lib64/libresolv.so.2 (0x7f3d30d6b000) libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f3d30b3a000) librt.so.1 = /lib64/librt.so.1 (0x7f3d30931000) libm.so.6 = /lib64/libm.so.6 (0x7f3d306b8000) libdl.so.2 = /lib64/libdl.so.2 (0x7f3d304b3000) libnsl.so.1 = /lib64/libnsl.so.1 (0x7f3d3029b000) libz.so.1 = /lib64/libz.so.1 (0x7f3d30085000) libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f3d2fd28000) libc.so.6 = /lib64/libc.so.6 (0x7f3d2f9b4000) libpthread.so.0 = /lib64/libpthread.so.0 (0x7f3d2f797000) /lib64/ld-linux-x86-64.so.2 (0x7f3d31c0f000) # ldd mod_php5.so.5.2.14 linux-vdso.so.1 = (0x7fffcdfff000) libmm.so.14 = /usr/lib64/libmm.so.14 (0x7f0307223000) libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f0307428000) libresolv.so.2 = /lib64/libresolv.so.2 (0x7f0306bd2000) libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f0306ff2000) librt.so.1 = /lib64/librt.so.1 (0x7f0306de9000) libm.so.6 = /lib64/libm.so.6 (0x7f0306958000) libdl.so.2 = /lib64/libdl.so.2 (0x7f0306754000) libnsl.so.1 = /lib64/libnsl.so.1 (0x7f030653c000) libz.so.1 = /lib64/libz.so.1 (0x7f0306325000) libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f0305fc9000) libc.so.6 = /lib64/libc.so.6 (0x7f0305c55000) libpthread.so.0 = /lib64/libpthread.so.0 (0x7f0305a37000) /lib64/ld-linux-x86-64.so.2 (0x7f0307b51000) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PEAR_Error reporting
Hello. I ran into trouble with a PEAR module and got only a blank (empty) page after filling in a loginform with PEAR::Auth I have error reporting in php.ini that create ordinary error message on my CentOS box, but it do not write error message when using PEAR. In a book I have is PEAR_Error mention, but it did not explain how to get it or run it. If you can help me in this question I am thankful for your time. Karl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php upload does not work proper, [tmp_name] and other are missing in $_FILES
On Wed, Mar 21, 2012 at 3:32 PM, Meike Stone meike.st...@googlemail.com wrote: But what is the reason, that the module not work properly? Which next step can I do? I figured out, that the new mod_php5.so is not linked against libmm.so.14. Can this be the problem? Thanks Meike # ldd mod_php5.so.5.3.8 linux-vdso.so.1 = (0x7fffe051c000) libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f3d30f82000) libresolv.so.2 = /lib64/libresolv.so.2 (0x7f3d30d6b000) libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f3d30b3a000) librt.so.1 = /lib64/librt.so.1 (0x7f3d30931000) libm.so.6 = /lib64/libm.so.6 (0x7f3d306b8000) libdl.so.2 = /lib64/libdl.so.2 (0x7f3d304b3000) libnsl.so.1 = /lib64/libnsl.so.1 (0x7f3d3029b000) libz.so.1 = /lib64/libz.so.1 (0x7f3d30085000) libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f3d2fd28000) libc.so.6 = /lib64/libc.so.6 (0x7f3d2f9b4000) libpthread.so.0 = /lib64/libpthread.so.0 (0x7f3d2f797000) /lib64/ld-linux-x86-64.so.2 (0x7f3d31c0f000) # ldd mod_php5.so.5.2.14 linux-vdso.so.1 = (0x7fffcdfff000) libmm.so.14 = /usr/lib64/libmm.so.14 (0x7f0307223000) libcrypt.so.1 = /lib64/libcrypt.so.1 (0x7f0307428000) libresolv.so.2 = /lib64/libresolv.so.2 (0x7f0306bd2000) libpcre.so.0 = /usr/lib64/libpcre.so.0 (0x7f0306ff2000) librt.so.1 = /lib64/librt.so.1 (0x7f0306de9000) libm.so.6 = /lib64/libm.so.6 (0x7f0306958000) libdl.so.2 = /lib64/libdl.so.2 (0x7f0306754000) libnsl.so.1 = /lib64/libnsl.so.1 (0x7f030653c000) libz.so.1 = /lib64/libz.so.1 (0x7f0306325000) libxml2.so.2 = /usr/lib64/libxml2.so.2 (0x7f0305fc9000) libc.so.6 = /lib64/libc.so.6 (0x7f0305c55000) libpthread.so.0 = /lib64/libpthread.so.0 (0x7f0305a37000) /lib64/ld-linux-x86-64.so.2 (0x7f0307b51000) I believe using libmm is optional, and the package maintainers probably had their reasons not to use it anymore. Mine is also compiled without libmm, though I'm on 5.3.10. Is it possible for you to upgrade to the latest version? That might solve the problem too, if not, I suggest to stick with the older one for a while. (and maybe submit a bug report) - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Thinking out loud - a continuation...
This is a continuation of the nested query thing I posted to the list a while back. I was finally able to output a nested unordered array that worked out well, but scope-creep has come in the door and I have to change gears. I have a project where I have multiple queries and each query uses the results from the previous query to get it's results. I need to do one of two things, either out put a multidimensional array that I can use json_encode() on or I have to format the output from the queries as a JSON string. The resulting JSON will be used by a JavaScript widget and must be formed correctly. I created the following array by hand: $userList = array(John = array( email = j...@demo.com, website = www.john.com, age = 22, password = pass, description = array( hair = blonde, eyes = blue, build = medium )), Anna = array( email = a...@demo.com, website = www.anna.com, age = 24, password = pass, description = array( hair = brunette, eyes = hazel, build = petite ) )); I ran it through json_encode() and got the following output {John:{email:j...@demo.com,website:www.john.com,age:22,password:pass,description:{hair:blonde,eyes:blue,build:medium}},Anna:{email:a...@demo.com,website:www.anna.com,age:24,password:pass,description:{hair:brunette,eyes:hazel,build:petite}}} jslint.com verifies this as good JSON (although I thought there had to be square brackets around child arrays). If you were me would you just generate the JSON? If not what is he best way to output an array that will nest properly for each subsequent query? Thanks for any insight!
Re: [PHP] Thinking out loud - a continuation...
On Wed, Mar 21, 2012 at 2:39 PM, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: ... I have a project where I have multiple queries and each query uses the results from the previous query to get it's results. I need to do one of two things, either out put a multidimensional array that I can use json_encode() on or I have to format the output from the queries as a JSON string. The resulting JSON will be used by a JavaScript widget and must be formed correctly. I created the following array by hand: $userList = array(John = array( email = j...@demo.com, website = www.john.com, age = 22, password = pass, description = array( hair = blonde, eyes = blue, build = medium )), Anna = array( email = a...@demo.com, website = www.anna.com, age = 24, password = pass, description = array( hair = brunette, eyes = hazel, build = petite ) )); I ran it through json_encode() and got the following output {John:{email:j...@demo.com,website:www.john.com,age:22,password:pass,description:{hair:blonde,eyes:blue,build:medium}},Anna:{email:a...@demo.com,website:www.anna.com,age:24,password:pass,description:{hair:brunette,eyes:hazel,build:petite}}} jslint.com verifies this as good JSON (although I thought there had to be square brackets around child arrays). Speaking to your belief that arrays had to have square brackets, json_encode examines the PHP array and only encodes sequential numbers JSON arrays. Others (as in your case) are encoded as object literals: http://php.net/manual/en/function.json-encode.php That said, you can still access Javascript Object properties with array access if you prefer in the client code: http://www.quirksmode.org/js/associative.html If you were me would you just generate the JSON? If not what is he best way to output an array that will nest properly for each subsequent query? Because of the options json_encode provides and the flexibility it affords while in PHP, I would generate PHP and then always use json_encode to generate the JSON as needed. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thinking out loud - a continuation...
On Wed, Mar 21, 2012 at 14:39, Jay Blanchard jay.blanch...@sigmaphinothing.org wrote: [snip!] I ran it through json_encode() and got the following output {John:{email:j...@demo.com,website:www.john.com,age:22,password:pass,description:{hair:blonde,eyes:blue,build:medium}},Anna:{email:a...@demo.com,website:www.anna.com,age:24,password:pass,description:{hair:brunette,eyes:hazel,build:petite}}} jslint.com verifies this as good JSON (although I thought there had to be square brackets around child arrays). If you were me would you just generate the JSON? If not what is he best way to output an array that will nest properly for each subsequent query? I would, yes, but that's not the point. Is Anna single? I'm ready to trade Debs in for a newer model. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thinking out loud - a continuation...
[snip] I would, yes, but that's not the point. Is Anna single? I'm ready to trade Debs in for a newer model. [/snip] I'm thinking that Debs would upset your array if you traded her in. Anyhow, I have spent the last hour trying to output valid JSON but the whole thing is making me barking mad. I may try create a multidimensional array here in a little bit. After I go for a walk. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thinking out loud - a continuation...
On 12-03-21 03:52 PM, Jay Blanchard wrote: [snip] I would, yes, but that's not the point. Is Anna single? I'm ready to trade Debs in for a newer model. [/snip] I'm thinking that Debs would upset your array if you traded her in. Anyhow, I have spent the last hour trying to output valid JSON but the whole thing is making me barking mad. I may try create a multidimensional array here in a little bit. After I go for a walk. Hi Jay, Why are you trying to create the JSON structure in parts? When I have nesting like this i build the full nested structure as PHP, then export to JSON. Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thinking out loud - a continuation...
[snip] Why are you trying to create the JSON structure in parts? When I have nesting like this i build the full nested structure as PHP, then export to JSON. [/snip] As PHP? An array? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thinking out loud - a continuation...
On 03/21/2012 11:39 AM, Jay Blanchard wrote: If you were me would you just generate the JSON? If not what is he best way to output an array that will nest properly for each subsequent query? Depends on where the data is coming from and how you are retrieving it from. Can you provide examples of the code that retrieves the data and some of the actual output data? Then provide a structure that you want the data to look like when done. -- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/ http://www.bendsource.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Node.PHP
Hey, So i had my first Hackathon at work last week and my project was to prototype making a node.js clone using PHP instead of V8. So i snatched up libuv and joyent's HTTP parser and set off on a 24 hour coding spree to get something workable. By the time the sun was coming out the next morning the following code was working. ?php $http = new node_http(); $http-listen(8080, function($request, $response) { $response-end(yay, super awesome response); }); nodephp_run(); ? The C code that powers it was whipped together really fast and is kind of hackish as a result. The code has some memory leaks that i haven't had time to fully track down yet. Some small portions of the code were borrowed from the phode project. In a naive benchmark on this simple server VS an equally simple server in node.js this implementation already out performs node.js in throughput by being able to serve just under 200% the amount of requests per second that node.js could. Take that with a grain of salt though because node.js has much more feature and is much more hardend from production use. I do believe the PHP binary will have some major performance gains over V8 as crossing the PHP -- C barrier seems to be a much lighter operation then crossing the V8 -- C++ barrier. Any help or feedback will be greatly appreciated. The projects source code can be found here: https://github.com/JosephMoniz/node.php - Joseph Moniz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thinking out loud - a continuation...
On 12-03-21 04:42 PM, Jay Blanchard wrote: [snip] Why are you trying to create the JSON structure in parts? When I have nesting like this i build the full nested structure as PHP, then export to JSON. [/snip] As PHP? An array? Yeah sorry... you know what I meant ;) Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php