@@ -567,13 +567,12 @@ static int ValidateFormat(char *format, int numVars, int *totalSubs)
567567 * format format string
568568 * argCount total number of elements in the args array
569569 * args arguments passed in from user function (f|s)scanf
570- * varStart offset (in args) of 1st variable passed in to (f|s)scanf
571570 * return_value set with the results of the scan
572571 */
573572
574573PHPAPI int php_sscanf_internal ( char * string , char * format ,
575574 uint32_t argCount , zval * args ,
576- int varStart , zval * return_value )
575+ zval * return_value )
577576{
578577 int numVars , nconversions , totalVars = -1 ;
579578 int i , result ;
@@ -591,11 +590,7 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
591590 char buf [64 ]; /* Temporary buffer to hold scanned number
592591 * strings before they are passed to strtoul() */
593592
594- /* do some sanity checking */
595- if ((varStart > argCount ) || (varStart < 0 )){
596- varStart = SCAN_MAX_ARGS + 1 ;
597- }
598- numVars = argCount - varStart ;
593+ numVars = argCount ;
599594 if (numVars < 0 ) {
600595 numVars = 0 ;
601596 }
@@ -608,13 +603,13 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
608603 return SCAN_ERROR_INVALID_FORMAT ;
609604 }
610605
611- objIndex = numVars ? varStart : 0 ;
606+ objIndex = 0 ;
612607
613608 /*
614609 * If any variables are passed, make sure they are all passed by reference
615610 */
616611 if (numVars ) {
617- for (i = varStart ; i < argCount ;i ++ ){
612+ for (i = 0 ; i < argCount ; i ++ ){
618613 ZEND_ASSERT (Z_ISREF (args [i ]) && "Parameter must be passed by reference" );
619614 }
620615 }
@@ -636,7 +631,6 @@ PHPAPI int php_sscanf_internal( char *string, char *format,
636631 return FAILURE ;
637632 }
638633 }
639- varStart = 0 ; /* Array index starts from 0 */
640634 }
641635
642636 baseString = string ;
0 commit comments