[PHP-DEV] mailparse
Hello, When you look up mailparse on php.net it doesn't say that this function is moved PEAR. Shouldn't this be corrected? http://www.php.net/manual/en/ref.mailparse.php -- / morten There are only 10 types of people in the world: Those who understand binary, and those who don't -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: changing max size to upload
Anil Garg [EMAIL PROTECTED] wrote in message 025d01c21876$40e08a20$[EMAIL PROTECTED]">news:025d01c21876$40e08a20$[EMAIL PROTECTED]... hi, sory to post this here. How can i change the maximum size of the file being uploaded?? The line below does not seem to help me: input type=hidden name=MAX_FILE_SIZE value=25000 Do i need to make some more changes?? php ver i am using is mod_php4-4.1.2 I dont have a php.ini file anywhere!! i just have a file php.ini-dist in /usr/local/etc/ ...but i dont think it is being used. One way is to enter values in httpd.conf php_admin_value post_max_size 3000 php_value upload_max_filesize 3000 / morten -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] standard platform names
On Wed, 2002-04-10 at 00:22, Stig S. Bakken wrote: The general format could be CPU-OS[-EXTRA] I like OS-CPU[-EXTRA] more. A shell script (as one of your examples) would often be CPU and EXTRA - but not OS - independend. If we use OS-CPU[-EXTRA] it runs on eg. linux-*, and not *-linux*. It's not often I have code that runs on _all_ powerpc's, no matter which OS. Just my .02 Euro, Morten -- Morten Poulsen [EMAIL PROTECTED] http://www.afdelingp.dk/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] [PATCH] sprintf() argnum
Hi, I discovered a bug in sprintf()'s argument swapping code. It accepts an argument number of zero, which is invalid. It is handled in different ways in different libcs, but i figured the best way to handle it in PHP was to make the functioncall fail. Patch is attached. Best regards, Morten PS. Thanks to mbn for whining :-) -- Morten Poulsen [EMAIL PROTECTED] http://www.afdelingp.dk/ Index: ext/standard/formatted_print.c === RCS file: /repository/php4/ext/standard/formatted_print.c,v retrieving revision 1.46 diff -u -r1.46 formatted_print.c --- ext/standard/formatted_print.c 28 Feb 2002 08:26:45 - 1.46 +++ ext/standard/formatted_print.c 21 Mar 2002 16:26:35 - @@ -479,7 +479,12 @@ temppos = inpos; while (isdigit((int)format[temppos])) temppos++; if (format[temppos] == '$') { - argnum = php_sprintf_getnumber(format, inpos); + if ((argnum = php_sprintf_getnumber(format, inpos)) == 0) { + efree(result); + efree(args); + php_error(E_WARNING, %s(): zero is not a valid argument number, get_active_function_name(TSRMLS_C)); + return NULL; + } inpos++; /* skip the '$' */ } else { argnum = currarg++; Index: tests/strings/002.phpt === RCS file: /repository/php4/tests/strings/002.phpt,v retrieving revision 1.3 diff -u -r1.3 002.phpt --- tests/strings/002.phpt 9 Apr 2001 15:44:24 - 1.3 +++ tests/strings/002.phpt 21 Mar 2002 16:26:36 - @@ -38,6 +38,7 @@ printf(printf test 27:%3\$d %d %d\n, 1, 2, 3); printf(printf test 28:%2\$02d %1\$2d\n, 1, 2); printf(printf test 29:%2\$-2d %1\$2d\n, 1, 2); +print(printf test 30:); printf(%0\$s, 1); print(x\n); ? --EXPECT-- @@ -72,3 +73,4 @@ printf test 27:3 1 2 printf test 28:02 1 printf test 29:2 1 +printf test 30:x -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] patch for sprintf() argnum
Hi, I discovered a bug in sprintf()'s argument swapping code. It accepts an argument number of zero, which is invalid. It is handled in different ways in different libcs, but i figured the best way to handle it in PHP was to make the functioncall fail. Patch is attached. Best regards, Morten PS. Thanks to mbn for whining :-) diff -ur php-4.1.2.orig/ext/standard/formatted_print.c php-4.1.2/ext/standard/formatted_print.c --- php-4.1.2.orig/ext/standard/formatted_print.c Fri Mar 15 16:33:12 2002 +++ php-4.1.2/ext/standard/formatted_print.c Fri Mar 15 17:12:29 2002 -479,7 +479,12 temppos = inpos; while (isdigit((int)format[temppos])) temppos++; if (format[temppos] == '$') { - argnum = php_sprintf_getnumber(format, inpos); + if ((argnum = php_sprintf_getnumber(format, inpos)) == 0) { + efree(result); + efree(args); + php_error(E_WARNING, %s(): zero is not a valid argument number, get_active_function_name(TSRMLS_C)); + return NULL; + } inpos++; /* skip the '$' */ } else { argnum = currarg++; diff -ur php-4.1.2.orig/tests/strings/002.phpt php-4.1.2/tests/strings/002.phpt --- php-4.1.2.orig/tests/strings/002.phpt Fri Mar 15 16:33:13 2002 +++ php-4.1.2/tests/strings/002.phpt Fri Mar 15 17:10:28 2002 -38,6 +38,7 printf(printf test 27:%3\$d %d %d\n, 1, 2, 3); printf(printf test 28:%2\$02d %1\$2d\n, 1, 2); printf(printf test 29:%2\$-2d %1\$2d\n, 1, 2); +print(printf test 30:); printf(%0\$s); print(x\n); ? --EXPECT-- -72,3 +73,4 printf test 27:3 1 2 printf test 28:02 1 printf test 29:2 1 +printf test 30:x -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] PHP 4.0.6 crypt ()
Operating system: MacOS X 10.0.3 PHP version: 4.0.6 PHP Bug Type: *Encryption and hash functions Bug description: crypt () seems to be gone... Hi, Is crypt () gone under Darwin 1.3.3...? I even compiled in libmcrypt but still no dice. Cheers, -Morten --- Rayon Interactive AS http://www.rayon.no Morten Lerskau Rønseth mailto:[EMAIL PROTECTED] Karenslyst Allé 16d Tlf.: (47) 2213 5250 0278 OsloFax : (47) 2213 5260 Norway ICQ: 25163080 PGP fingerprint: F851 91B6 1D81 1409 8B62 3E14 5A60 65F8 5AF4 56AF -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10748 Updated: LIBGD20 must be enabled manually in main/php_config.h
ID: 10748 User Update by: [EMAIL PROTECTED] Status: Open Bug Type: *Configuration Issues Operating system: Linux 2.4.3 PHP Version: 4.0 Latest CVS (2001-05-09) Description: LIBGD20 must be enabled manually in main/php_config.h using todays CVS, the configure script successfully detects libgd2 excellent! (by the way... any eta on 4.0.6?) Previous Comments: --- [2001-05-10 05:54:53] [EMAIL PROTECTED] I still have problems with Bug 10747, so I can't check it yet --- [2001-05-10 05:24:16] [EMAIL PROTECTED] Can you try the latest CVS again? I have changed the configure script a lot.. --Jani --- [2001-05-09 12:05:26] [EMAIL PROTECTED] ./configure --prefix=/usr --with-apxs=/usr/sbin/apxs --with-config-file-path=/etc/httpd --with-regex=system --with-exec-dir=/usr/bin --enable-safe-mode --enable-debugger --enable-magic-quotes --enable-track-vars --enable-memory-limit --enable-ftp --disable-debug --disable-rpath --with-bz2 --with-zlib=/usr --with-gmp --with-imap=shared,/usr --with-ldap=shared,/usr --with-mysql=shared,/usr --with-pgsql=shared,/usr --with-openssl=shared,/usr --with-gd=shared,/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr/local I haven't got my config.log at the moment, as I updated to newest CVS, and that failed while running buildconf... --- [2001-05-09 08:29:04] [EMAIL PROTECTED] It works for me... Can you post your configure line and email your config.log file to [EMAIL PROTECTED] so that I can check into it? --Wez. --- [2001-05-09 07:44:25] [EMAIL PROTECTED] the configure script doesn't detect libgd2 automatically it is neccessary to put this in manually #define HAVE_LIBGD20 1 --- The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online. Full Bug description available at: http://bugs.php.net/?id=10748 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10812: libtool syntax error
From: [EMAIL PROTECTED] Operating system: Linux 2.4.3 PHP version: 4.0 Latest CVS (2001-05-11) PHP Bug Type: Compile Failure Bug description: libtool syntax error root@Tenchi /usr/src/php4# make Making all in Zend make[1]: Entering directory `/usr/src/php4/Zend' flex -Pzend -ozend_language_scanner.c -i ./zend_language_scanner.l bison -y -p zend -v -d ./zend_language_parser.y -o zend_language_parser.c /bin/sh ../libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../main -DLINUX=22 -DMOD_SSL=208102 -DEAPI -DUSE_EXPAT -DSUPPORT_UTF8 -DXML_BYTE_ORDER=12 -g -O2 -c zend_language_scanner.c ../libtool: line 1292: syntax error near unexpected token `' ../libtool: line 1292: ` ltmain.sh' make[1]: *** [zend_language_scanner.lo] Error 2 make[1]: Leaving directory `/usr/src/php4/Zend' make: *** [all-recursive] Error 1 -- Edit Bug report at: http://bugs.php.net/?id=10812edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10812 Updated: libtool syntax error
ID: 10812 User Update by: [EMAIL PROTECTED] Old-Status: Feedback Status: Open Bug Type: Compile Failure Operating system: Linux 2.4.3 PHP Version: 4.0 Latest CVS (2001-05-11) Description: libtool syntax error It appears that the problem was me not knowing I had to do a separate buildconf and configure for Zend and TSRM. perhaps mentioning this in the CVS howto-thingie? Previous Comments: --- [2001-05-11 06:53:55] [EMAIL PROTECTED] Please use a fresh checkout of the Zend directory, as this problem does not occur for me. --- [2001-05-11 06:42:22] [EMAIL PROTECTED] root@Tenchi /usr/src/php4# make Making all in Zend make[1]: Entering directory `/usr/src/php4/Zend' flex -Pzend -ozend_language_scanner.c -i ./zend_language_scanner.l bison -y -p zend -v -d ./zend_language_parser.y -o zend_language_parser.c /bin/sh ../libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../main -DLINUX=22 -DMOD_SSL=208102 -DEAPI -DUSE_EXPAT -DSUPPORT_UTF8 -DXML_BYTE_ORDER=12 -g -O2 -c zend_language_scanner.c ../libtool: line 1292: syntax error near unexpected token `' ../libtool: line 1292: ` ltmain.sh' make[1]: *** [zend_language_scanner.lo] Error 2 make[1]: Leaving directory `/usr/src/php4/Zend' make: *** [all-recursive] Error 1 --- Full Bug description available at: http://bugs.php.net/?id=10812 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10748 Updated: LIBGD20 must be enabled manually in main/php_config.h
ID: 10748 User Update by: [EMAIL PROTECTED] Old-Status: Feedback Status: Open Bug Type: *Configuration Issues Operating system: Linux 2.4.3 PHP Version: 4.0 Latest CVS (2001-05-09) Description: LIBGD20 must be enabled manually in main/php_config.h I still have problems with Bug 10747, so I can't check it yet Previous Comments: --- [2001-05-10 05:24:16] [EMAIL PROTECTED] Can you try the latest CVS again? I have changed the configure script a lot.. --Jani --- [2001-05-09 12:05:26] [EMAIL PROTECTED] ./configure --prefix=/usr --with-apxs=/usr/sbin/apxs --with-config-file-path=/etc/httpd --with-regex=system --with-exec-dir=/usr/bin --enable-safe-mode --enable-debugger --enable-magic-quotes --enable-track-vars --enable-memory-limit --enable-ftp --disable-debug --disable-rpath --with-bz2 --with-zlib=/usr --with-gmp --with-imap=shared,/usr --with-ldap=shared,/usr --with-mysql=shared,/usr --with-pgsql=shared,/usr --with-openssl=shared,/usr --with-gd=shared,/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr/local I haven't got my config.log at the moment, as I updated to newest CVS, and that failed while running buildconf... --- [2001-05-09 08:29:04] [EMAIL PROTECTED] It works for me... Can you post your configure line and email your config.log file to [EMAIL PROTECTED] so that I can check into it? --Wez. --- [2001-05-09 07:44:25] [EMAIL PROTECTED] the configure script doesn't detect libgd2 automatically it is neccessary to put this in manually #define HAVE_LIBGD20 1 --- Full Bug description available at: http://bugs.php.net/?id=10748 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10747 Updated: buildconf fails with missing macros
ID: 10747 User Update by: [EMAIL PROTECTED] Status: Closed Bug Type: Compile Failure Operating system: Linux 2.4.3 PHP Version: 4.0 Latest CVS (2001-05-09) Description: buildconf fails with missing macros root@Tenchi /usr/src/php4# cvs -d :pserver:[EMAIL PROTECTED]:/repository co php4 root@Tenchi /usr/src/php4# cvs -d :pserver:[EMAIL PROTECTED]:/repository co Zend TSRM root@Tenchi /usr/src/php4# ./buildconf buildconf: checking installation... buildconf: autoconf version 2.13 (ok) buildconf: automake version 1.4 (ok) buildconf: libtool version 1.4 (ok) rebuilding Makefile templates rebuilding configure autoconf: Undefined macros: ***BUG in Autoconf--please report*** AC_ADD_INCLUDE ***BUG in Autoconf--please report*** AC_ADD_LIBRARY_WITH_PATH rebuilding acconfig.h rebuilding main/php_config.h.in Previous Comments: --- [2001-05-10 05:22:30] [EMAIL PROTECTED] Should be fixed now. --- [2001-05-09 07:34:19] [EMAIL PROTECTED] root@Tenchi /usr/src/php4# ./buildconf buildconf: checking installation... buildconf: autoconf version 2.13 (ok) buildconf: automake version 1.4 (ok) buildconf: libtool version 1.4 (ok) rebuilding Makefile templates rebuilding configure autoconf: Undefined macros: ***BUG in Autoconf--please report*** AC_ADD_INCLUDE ***BUG in Autoconf--please report*** AC_ADD_LIBRARY_WITH_PATH rebuilding acconfig.h rebuilding main/php_config.h.in my autoconf is the one from ftp.gnu.org --- Full Bug description available at: http://bugs.php.net/?id=10747 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10747: buildconf fails with missing macros
From: [EMAIL PROTECTED] Operating system: Linux 2.4.3 PHP version: 4.0 Latest CVS (2001-05-09) PHP Bug Type: Compile Failure Bug description: buildconf fails with missing macros root@Tenchi /usr/src/php4# ./buildconf buildconf: checking installation... buildconf: autoconf version 2.13 (ok) buildconf: automake version 1.4 (ok) buildconf: libtool version 1.4 (ok) rebuilding Makefile templates rebuilding configure autoconf: Undefined macros: ***BUG in Autoconf--please report*** AC_ADD_INCLUDE ***BUG in Autoconf--please report*** AC_ADD_LIBRARY_WITH_PATH rebuilding acconfig.h rebuilding main/php_config.h.in my autoconf is the one from ftp.gnu.org -- Edit Bug report at: http://bugs.php.net/?id=10747edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10748: LIBGD20 must be enabled manually in main/php_config.h
From: [EMAIL PROTECTED] Operating system: Linux 2.4.3 PHP version: 4.0 Latest CVS (2001-05-09) PHP Bug Type: *Configuration Issues Bug description: LIBGD20 must be enabled manually in main/php_config.h the configure script doesn't detect libgd2 automatically it is neccessary to put this in manually #define HAVE_LIBGD20 1 -- Edit Bug report at: http://bugs.php.net/?id=10748edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10748 Updated: LIBGD20 must be enabled manually in main/php_config.h
ID: 10748 User Update by: [EMAIL PROTECTED] Old-Status: Feedback Status: Open Bug Type: *Configuration Issues Operating system: Linux 2.4.3 PHP Version: 4.0 Latest CVS (2001-05-09) Description: LIBGD20 must be enabled manually in main/php_config.h ./configure \ --prefix=/usr \ --with-apxs=/usr/sbin/apxs \ --with-config-file-path=/etc/httpd \ --with-regex=system \ --with-exec-dir=/usr/bin \ --enable-safe-mode \ --enable-debugger \ --enable-magic-quotes \ --enable-track-vars \ --enable-memory-limit \ --enable-ftp \ --disable-debug \ --disable-rpath \ --with-bz2 \ --with-zlib=/usr \ --with-gmp \ --with-imap=shared,/usr \ --with-ldap=shared,/usr \ --with-mysql=shared,/usr \ --with-pgsql=shared,/usr \ --with-openssl=shared,/usr \ --with-gd=shared,/usr \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-freetype-dir=/usr/local I haven't got my config.log at the moment, as I updated to newest CVS, and that failed while running buildconf... Previous Comments: --- [2001-05-09 08:29:04] [EMAIL PROTECTED] It works for me... Can you post your configure line and email your config.log file to [EMAIL PROTECTED] so that I can check into it? --Wez. --- [2001-05-09 07:44:25] [EMAIL PROTECTED] the configure script doesn't detect libgd2 automatically it is neccessary to put this in manually #define HAVE_LIBGD20 1 --- Full Bug description available at: http://bugs.php.net/?id=10748 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] printf argument swapping patch
Hi, Rasmus Lerdorf [EMAIL PROTECTED] said: Would you mind writing a test case or two to go along with this patch? See the tests/README file for help on how to write these. no, of cause. The attached patch also contains four more tests for printf (tests/strings/002.phpt), which tests the added feature. -- mortenp Thus spake the master programmer: "Let the programmers be many and the managers few -- then all will be productive." diff -ur php-4.0.4pl1.orig/ext/standard/formatted_print.c php-4.0.4pl1/ext/standard/formatted_print.c --- php-4.0.4pl1.orig/ext/standard/formatted_print.cFri Apr 6 16:07:49 2001 +++ php-4.0.4pl1/ext/standard/formatted_print.c Mon Apr 9 16:33:42 2001 @@ -390,8 +390,8 @@ php_formatted_print(int ht, int *len) { pval ***args; - int argc, size = 240, inpos = 0, outpos = 0; - int alignment, width, precision, currarg, adjusting; + int argc, size = 240, inpos = 0, outpos = 0, temppos; + int alignment, width, precision, currarg, adjusting, argnum; char *format, *result, padding; argc = ZEND_NUM_ARGS(); @@ -437,7 +437,23 @@ PRINTF_DEBUG(("sprintf: first looking at '%c', inpos=%d\n", format[inpos], inpos)); if (isascii((int)format[inpos]) !isalpha((int)format[inpos])) { - /* first look for modifiers */ + /* first look for argnum */ + temppos = inpos; + while (isdigit((int)format[temppos])) temppos++; + if (format[temppos] == '$') { + argnum = php_sprintf_getnumber(format, inpos); + inpos++; /* skip the '$' */ + } else { + argnum = currarg++; + } + if (argnum = argc) { + efree(result); + efree(args); + php_error(E_WARNING, "%s(): too few +arguments",get_active_function_name()); + return NULL; + } + + /* after argnum comes modifiers */ PRINTF_DEBUG(("sprintf: looking for modifiers\n" "sprintf: now looking at '%c', inpos=%d\n", format[inpos], inpos)); @@ -469,7 +485,7 @@ } PRINTF_DEBUG(("sprintf: width=%d\n", width)); - /* after width comes precision */ + /* after width and argnum comes precision */ if (format[inpos] == '.') { inpos++; PRINTF_DEBUG(("sprintf: getting precision\n")); @@ -486,6 +502,7 @@ PRINTF_DEBUG(("sprintf: precision=%d\n", precision)); } else { width = precision = 0; + argnum = currarg++; } if (format[inpos] == 'l') { @@ -495,67 +512,67 @@ /* now we expect to find a type specifier */ switch (format[inpos]) { case 's': - convert_to_string_ex(args[currarg]); + convert_to_string_ex(args[argnum]); php_sprintf_appendstring(result, outpos, size, - (*args[currarg])-value.str.val, + + (*args[argnum])-value.str.val, width, precision, padding, alignment, - (*args[currarg])-value.str.len, + + (*args[argnum])-value.str.len, 0, expprec); break; case 'd': - convert_to_long_ex(args[currarg]); + convert_to_long_ex(args[argnum]);
[PHP-DEV] printf argument swapping patch
Hi PHP Team, I have made a patch, so PHP can support swapping of arguments to printf (and friends), the way libc do it. This is especialy usefull when doing internationalization (see http://www.gnu.org/manual/gettext/html_mono/gettext.html#SEC17 for example), but it is also usefull when you need to print some argument several times. I hope it's usefull :-) Greetings, Morten -- mortenp "Programs expand to fill the memory available to hold them" --- Parkinson's Law diff -ur php-4.0.4pl1.orig/ext/standard/formatted_print.c php-4.0.4pl1/ext/standard/formatted_print.c --- php-4.0.4pl1.orig/ext/standard/formatted_print.cFri Apr 6 16:07:49 2001 +++ php-4.0.4pl1/ext/standard/formatted_print.c Fri Apr 6 16:48:02 2001 @@ -391,7 +391,7 @@ { pval ***args; int argc, size = 240, inpos = 0, outpos = 0; - int alignment, width, precision, currarg, adjusting; + int alignment, width, precision, currarg, adjusting, argnum, tempnum; char *format, *result, padding; argc = ZEND_NUM_ARGS(); @@ -459,17 +459,38 @@ (alignment == ALIGN_LEFT) ? "left" : "right")); - /* after modifiers comes width */ + /* after modifiers comes width or argnum */ if (isdigit((int)format[inpos])) { - PRINTF_DEBUG(("sprintf: getting width\n")); - width = php_sprintf_getnumber(format, inpos); - adjusting |= ADJ_WIDTH; + PRINTF_DEBUG(("sprintf: getting width or +argnum\n")); + tempnum = php_sprintf_getnumber(format, +inpos); + if (format[inpos] == '$') { + argnum = tempnum; + inpos++; /* skip the '$' */ + if (isdigit((int)format[inpos])) { + width = +php_sprintf_getnumber(format, inpos); + adjusting |= ADJ_WIDTH; + } else { + width = 0; + } + } else { + argnum = currarg++; + width = tempnum; + adjusting |= ADJ_WIDTH; + } } else { + argnum = currarg++; width = 0; } PRINTF_DEBUG(("sprintf: width=%d\n", width)); - /* after width comes precision */ + if (argnum = argc) { + efree(result); + efree(args); + php_error(E_WARNING, "%s(): too few +arguments",get_active_function_name()); + return NULL; + } + + /* after width and argnum comes precision */ if (format[inpos] == '.') { inpos++; PRINTF_DEBUG(("sprintf: getting precision\n")); @@ -495,67 +516,67 @@ /* now we expect to find a type specifier */ switch (format[inpos]) { case 's': - convert_to_string_ex(args[currarg]); + convert_to_string_ex(args[argnum]); php_sprintf_appendstring(result, outpos, size, - (*args[currarg])-value.str.val, + + (*args[argnum])-value.str.val, width, precision, padding, alignment, - (*args[currarg])-value.str.len, + + (*args[argnum])-value.str.len,
Re: [PHP-DEV] printf argument swapping patch
Morten Poulsen [EMAIL PROTECTED] said: I hope it's usefull :-) is's not! i just found a bug.. i'll fix it and send a new patch, sorry.. -- mortenp Thus spake the master programmer: "Let the programmers be many and the managers few -- then all will be productive." -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] printf argument swapping patch
Morten Poulsen [EMAIL PROTECTED] said: i'll fix it and send a new patch, sorry.. Allright, here is the new patch. Sorry about all the fuzz. Greetings, Morten -- mortenp Thus spake the master programmer: "Let the programmers be many and the managers few -- then all will be productive." diff -ur php-4.0.4pl1.orig/ext/standard/formatted_print.c php-4.0.4pl1/ext/standard/formatted_print.c --- php-4.0.4pl1.orig/ext/standard/formatted_print.cFri Apr 6 16:07:49 2001 +++ php-4.0.4pl1/ext/standard/formatted_print.c Fri Apr 6 18:19:38 2001 @@ -391,7 +391,7 @@ { pval ***args; int argc, size = 240, inpos = 0, outpos = 0; - int alignment, width, precision, currarg, adjusting; + int alignment, width, precision, currarg, adjusting, argnum, tempnum; char *format, *result, padding; argc = ZEND_NUM_ARGS(); @@ -459,17 +459,38 @@ (alignment == ALIGN_LEFT) ? "left" : "right")); - /* after modifiers comes width */ + /* after modifiers comes width or argnum */ if (isdigit((int)format[inpos])) { - PRINTF_DEBUG(("sprintf: getting width\n")); - width = php_sprintf_getnumber(format, inpos); - adjusting |= ADJ_WIDTH; + PRINTF_DEBUG(("sprintf: getting width or +argnum\n")); + tempnum = php_sprintf_getnumber(format, +inpos); + if (format[inpos] == '$') { + argnum = tempnum; + inpos++; /* skip the '$' */ + if (isdigit((int)format[inpos])) { + width = +php_sprintf_getnumber(format, inpos); + adjusting |= ADJ_WIDTH; + } else { + width = 0; + } + } else { + argnum = currarg++; + width = tempnum; + adjusting |= ADJ_WIDTH; + } } else { + argnum = currarg++; width = 0; } PRINTF_DEBUG(("sprintf: width=%d\n", width)); - /* after width comes precision */ + if (argnum = argc) { + efree(result); + efree(args); + php_error(E_WARNING, "%s(): too few +arguments",get_active_function_name()); + return NULL; + } + + /* after width and argnum comes precision */ if (format[inpos] == '.') { inpos++; PRINTF_DEBUG(("sprintf: getting precision\n")); @@ -486,6 +507,7 @@ PRINTF_DEBUG(("sprintf: precision=%d\n", precision)); } else { width = precision = 0; + argnum = currarg++; } if (format[inpos] == 'l') { @@ -495,67 +517,67 @@ /* now we expect to find a type specifier */ switch (format[inpos]) { case 's': - convert_to_string_ex(args[currarg]); + convert_to_string_ex(args[argnum]); php_sprintf_appendstring(result, outpos, size, - (*args[currarg])-value.str.val, + + (*args[argnum])-value.str.val, width, precision, padding, alignment, - (*args[currarg])-value.str.len, +