I wrote some PHP code months ago and it been going swimmingly ..... until about a month ago. And I've traced the problem back to an array. Where the code use to be able to extract from the array a photo number, it now extracts the array number.

1 123456789
2 333333333
3 498838835
4 588858585

So where the code extracted 33333333 from the second query of the array....now I get '2'.

So I'm just looking into this but the only change I'm aware of is a switch to php 444 (Lunar Pages).

I'll start here and cut and paste more code and output as a can. Any initial pointers are welcome.

the run thru the array is Foreach

foreach ($phpus2b['Images'] as $key => $value2 )
{

    You could insert a print_r($phpus2b['Images']) just before the foreach loop to get a clearer view of the problem.

      print_r($phpus2b);

      (
      [stat] => ok
      [method] => smugmug.images.get
      [Images] => Array
      (
      [0] => Array
      (
      [id] => 163606406
      )

              [1] => Array
                  (
                      [id] => 163604405
                  )
      
              [2] => Array
                  (
                      [id] => 163597823
                  )
      
              [3] => Array
                  (
                      [id] => 163591408
                  )
      
              [4] => Array
                  (
                      [id] => 163585609.................

      Is this an array of arrays? More doc to follow.

        code:
        echo nl2br(". \n second print r IMAGES to follow .");
        print_r($phpus2b['Images']);

        output:
        second print r IMAGES to follow
        .Array

        (
        [0] => Array
        (
        [id] => 163606406
        )

        [1] => Array
            (
                [id] => 163604405
            )
        
        [2] => Array
            (
                [id] => 163597823
            )
        
        [3] => Array
            (
                [id] => 163591408
            )
        
        [4] => Array
            (
                [id] => 163585609
            )
        
        [5] => Array
            (

          code:
          foreach ($phpus2b['Images'] as $key => $value )
          {

          if ($verbose_on == 'yes') { // if verbose_on = yes then print

          echo nl2br(". \n Begin central processing (FOREACH). Current Image is: $key .");
          echo nl2br(". \n continue cnt proc (FOREACH). Current value2 is: $value .");

                                                   }  // end of verbose if 

          output:
          Begin central processing (FOREACH). Current Image is: 0 ..

          continue cnt proc (FOREACH). Current value2 is: Array ..

          and some error checking flags:

          code:

          /-------------------------- Error checking. Is the Gallery empty --------------
          if (empty ($key)) {
          echo nl2br(". \n .");
          echo " ERROR ! --- This is an unexpected condition. Core email album processing
          has looped beyond the total number of images in email or the email album is empty";

          $protect_on = 'yes'; // We are screwed. Set protect on and do no processing.

          output:

          . ERROR ! --- This is an unexpected condition. Core email album processing
          has looped beyond the total number of images in email or the email album is empty.

          Looks like the array structure has changed.

            Write a Reply...